Merge pull request #1112 from mirumee/feature/SALEOR-3109-attribute-values-pagination

Feature/SALEOR-3109 Use pagination on attribute values
This commit is contained in:
Marcin Gębala 2021-06-08 12:28:16 +02:00 committed by GitHub
commit b0e143b4c5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
126 changed files with 6514 additions and 5287 deletions

View file

@ -47,6 +47,7 @@ All notable, unreleased changes to this project will be documented in this file.
- Add service worker - #1073 by @dominik-zeglen - Add service worker - #1073 by @dominik-zeglen
- Choosing user shipping and billing addresses for draft order - #1082 by @orzechdev - Choosing user shipping and billing addresses for draft order - #1082 by @orzechdev
- Fix EditorJS inline formatting - #1096 by @orzechdev - Fix EditorJS inline formatting - #1096 by @orzechdev
- Add pagination on attribute values - #1112 by @orzechdev
# 2.11.1 # 2.11.1

View file

@ -10,7 +10,13 @@ export function createAttribute(name, attributeValues = ["value"]) {
attribute{ attribute{
id id
name name
values{name} choices(first: 100){
edges{
node{
name
}
}
}
} }
attributeErrors{ attributeErrors{
field field

View file

@ -5643,6 +5643,10 @@
"context": "variant name", "context": "variant name",
"string": "Variant" "string": "Variant"
}, },
"src_dot_products_dot_components_dot_ProductVariantCreatorPage_dot_multipleValueLabel": {
"context": "attribute values",
"string": "Values"
},
"src_dot_products_dot_components_dot_ProductVariantDeleteDialog_dot_1583616500": { "src_dot_products_dot_components_dot_ProductVariantDeleteDialog_dot_1583616500": {
"context": "button", "context": "button",
"string": "Delete variant" "string": "Delete variant"

View file

@ -413,7 +413,7 @@ type Attribute implements Node & ObjectWithMetadata {
slug: String slug: String
type: AttributeTypeEnum type: AttributeTypeEnum
unit: MeasurementUnitsEnum unit: MeasurementUnitsEnum
values: [AttributeValue] choices(sortBy: AttributeChoicesSortingInput, filter: AttributeValueFilterInput, before: String, after: String, first: Int, last: Int): AttributeValueCountableConnection
valueRequired: Boolean! valueRequired: Boolean!
visibleInStorefront: Boolean! visibleInStorefront: Boolean!
filterableInStorefront: Boolean! filterableInStorefront: Boolean!
@ -429,6 +429,16 @@ type AttributeBulkDelete {
errors: [AttributeError!]! errors: [AttributeError!]!
} }
enum AttributeChoicesSortField {
NAME
SLUG
}
input AttributeChoicesSortingInput {
direction: OrderDirection!
field: AttributeChoicesSortField!
}
type AttributeCountableConnection { type AttributeCountableConnection {
pageInfo: PageInfo! pageInfo: PageInfo!
edges: [AttributeCountableEdge!]! edges: [AttributeCountableEdge!]!
@ -606,6 +616,17 @@ type AttributeValueBulkDelete {
errors: [AttributeError!]! errors: [AttributeError!]!
} }
type AttributeValueCountableConnection {
pageInfo: PageInfo!
edges: [AttributeValueCountableEdge!]!
totalCount: Int
}
type AttributeValueCountableEdge {
node: AttributeValue!
cursor: String!
}
type AttributeValueCreate { type AttributeValueCreate {
attribute: Attribute attribute: Attribute
attributeErrors: [AttributeError!]! @deprecated(reason: "Use errors field instead. This field will be removed in Saleor 4.0.") attributeErrors: [AttributeError!]! @deprecated(reason: "Use errors field instead. This field will be removed in Saleor 4.0.")
@ -626,6 +647,10 @@ type AttributeValueDelete {
attributeValue: AttributeValue attributeValue: AttributeValue
} }
input AttributeValueFilterInput {
search: String
}
input AttributeValueInput { input AttributeValueInput {
id: ID id: ID
values: [String] values: [String]
@ -794,7 +819,7 @@ type CategoryTranslation implements Node {
id: ID! id: ID!
seoTitle: String seoTitle: String
seoDescription: String seoDescription: String
name: String! name: String
description: JSONString description: JSONString
language: LanguageDisplay! language: LanguageDisplay!
descriptionJson: JSONString @deprecated(reason: "Will be removed in Saleor 4.0. Use the `description` field instead.") descriptionJson: JSONString @deprecated(reason: "Will be removed in Saleor 4.0. Use the `description` field instead.")
@ -1268,7 +1293,7 @@ type CollectionTranslation implements Node {
id: ID! id: ID!
seoTitle: String seoTitle: String
seoDescription: String seoDescription: String
name: String! name: String
description: JSONString description: JSONString
language: LanguageDisplay! language: LanguageDisplay!
descriptionJson: JSONString @deprecated(reason: "Will be removed in Saleor 4.0. Use the `description` field instead.") descriptionJson: JSONString @deprecated(reason: "Will be removed in Saleor 4.0. Use the `description` field instead.")
@ -3592,6 +3617,7 @@ input PageFilterInput {
search: String search: String
metadata: [MetadataInput] metadata: [MetadataInput]
pageTypes: [ID] pageTypes: [ID]
ids: [ID]
} }
type PageInfo { type PageInfo {
@ -3651,7 +3677,7 @@ type PageTranslation implements Node {
id: ID! id: ID!
seoTitle: String seoTitle: String
seoDescription: String seoDescription: String
title: String! title: String
content: JSONString content: JSONString
language: LanguageDisplay! language: LanguageDisplay!
contentJson: JSONString @deprecated(reason: "Will be removed in Saleor 4.0. Use the `content` field instead.") contentJson: JSONString @deprecated(reason: "Will be removed in Saleor 4.0. Use the `content` field instead.")
@ -4397,7 +4423,7 @@ type ProductTranslation implements Node {
id: ID! id: ID!
seoTitle: String seoTitle: String
seoDescription: String seoDescription: String
name: String! name: String
description: JSONString description: JSONString
language: LanguageDisplay! language: LanguageDisplay!
descriptionJson: JSONString @deprecated(reason: "Will be removed in Saleor 4.0. Use the `description` field instead.") descriptionJson: JSONString @deprecated(reason: "Will be removed in Saleor 4.0. Use the `description` field instead.")

View file

@ -192,9 +192,6 @@ const AttributeList: React.FC<AttributeListProps> = ({
className={classes.link} className={classes.link}
data-test="id" data-test="id"
data-test-id={maybe(() => attribute.id)} data-test-id={maybe(() => attribute.id)}
data-test-values={JSON.stringify(
maybe(() => attribute.values, [])
)}
> >
<TableCell padding="checkbox"> <TableCell padding="checkbox">
<Checkbox <Checkbox

View file

@ -1,3 +1,4 @@
import { AttributeDetails_attribute_choices } from "@saleor/attributes/types/AttributeDetails";
import { ATTRIBUTE_TYPES_WITH_DEDICATED_VALUES } from "@saleor/attributes/utils/data"; import { ATTRIBUTE_TYPES_WITH_DEDICATED_VALUES } from "@saleor/attributes/utils/data";
import AppHeader from "@saleor/components/AppHeader"; import AppHeader from "@saleor/components/AppHeader";
import CardSpacer from "@saleor/components/CardSpacer"; import CardSpacer from "@saleor/components/CardSpacer";
@ -9,21 +10,18 @@ import Metadata from "@saleor/components/Metadata/Metadata";
import { MetadataFormData } from "@saleor/components/Metadata/types"; import { MetadataFormData } from "@saleor/components/Metadata/types";
import PageHeader from "@saleor/components/PageHeader"; import PageHeader from "@saleor/components/PageHeader";
import SaveButtonBar from "@saleor/components/SaveButtonBar"; import SaveButtonBar from "@saleor/components/SaveButtonBar";
import { import { AttributeDetailsFragment } from "@saleor/fragments/types/AttributeDetailsFragment";
AttributeDetailsFragment,
AttributeDetailsFragment_values
} from "@saleor/fragments/types/AttributeDetailsFragment";
import { AttributeErrorFragment } from "@saleor/fragments/types/AttributeErrorFragment"; import { AttributeErrorFragment } from "@saleor/fragments/types/AttributeErrorFragment";
import { sectionNames } from "@saleor/intl"; import { sectionNames } from "@saleor/intl";
import { maybe } from "@saleor/misc"; import { maybe } from "@saleor/misc";
import { ReorderAction } from "@saleor/types"; import { ListSettings, ReorderAction } from "@saleor/types";
import { import {
AttributeEntityTypeEnum, AttributeEntityTypeEnum,
AttributeInputTypeEnum, AttributeInputTypeEnum,
AttributeTypeEnum, AttributeTypeEnum,
MeasurementUnitsEnum MeasurementUnitsEnum
} from "@saleor/types/globalTypes"; } from "@saleor/types/globalTypes";
import { mapMetadataItemToInput } from "@saleor/utils/maps"; import { mapEdgesToItems, mapMetadataItemToInput } from "@saleor/utils/maps";
import useMetadataChangeTrigger from "@saleor/utils/metadata/useMetadataChangeTrigger"; import useMetadataChangeTrigger from "@saleor/utils/metadata/useMetadataChangeTrigger";
import React from "react"; import React from "react";
import { useIntl } from "react-intl"; import { useIntl } from "react-intl";
@ -39,7 +37,7 @@ export interface AttributePageProps {
disabled: boolean; disabled: boolean;
errors: AttributeErrorFragment[]; errors: AttributeErrorFragment[];
saveButtonBarState: ConfirmButtonTransitionState; saveButtonBarState: ConfirmButtonTransitionState;
values: AttributeDetailsFragment_values[]; values: AttributeDetails_attribute_choices;
onBack: () => void; onBack: () => void;
onDelete: () => void; onDelete: () => void;
onSubmit: (data: AttributePageFormData) => void; onSubmit: (data: AttributePageFormData) => void;
@ -47,6 +45,14 @@ export interface AttributePageProps {
onValueDelete: (id: string) => void; onValueDelete: (id: string) => void;
onValueReorder: ReorderAction; onValueReorder: ReorderAction;
onValueUpdate: (id: string) => void; onValueUpdate: (id: string) => void;
settings?: ListSettings;
onUpdateListSettings?: (key: keyof ListSettings, value: any) => void;
pageInfo: {
hasNextPage: boolean;
hasPreviousPage: boolean;
};
onNextPage: () => void;
onPreviousPage: () => void;
} }
export interface AttributePageFormData extends MetadataFormData { export interface AttributePageFormData extends MetadataFormData {
@ -76,7 +82,12 @@ const AttributePage: React.FC<AttributePageProps> = ({
onValueAdd, onValueAdd,
onValueDelete, onValueDelete,
onValueReorder, onValueReorder,
onValueUpdate onValueUpdate,
settings,
onUpdateListSettings,
pageInfo,
onNextPage,
onPreviousPage
}) => { }) => {
const intl = useIntl(); const intl = useIntl();
const { const {
@ -190,11 +201,16 @@ const AttributePage: React.FC<AttributePageProps> = ({
<CardSpacer /> <CardSpacer />
<AttributeValues <AttributeValues
disabled={disabled} disabled={disabled}
values={values} values={mapEdgesToItems(values)}
onValueAdd={onValueAdd} onValueAdd={onValueAdd}
onValueDelete={onValueDelete} onValueDelete={onValueDelete}
onValueReorder={onValueReorder} onValueReorder={onValueReorder}
onValueUpdate={onValueUpdate} onValueUpdate={onValueUpdate}
settings={settings}
onUpdateListSettings={onUpdateListSettings}
pageInfo={pageInfo}
onNextPage={onNextPage}
onPreviousPage={onPreviousPage}
/> />
</> </>
)} )}

View file

@ -19,13 +19,11 @@ import { getFormErrors } from "@saleor/utils/errors";
import React from "react"; import React from "react";
import { FormattedMessage, useIntl } from "react-intl"; import { FormattedMessage, useIntl } from "react-intl";
import { AttributeDetails_attribute_values } from "../../types/AttributeDetails";
export interface AttributeValueEditDialogFormData { export interface AttributeValueEditDialogFormData {
name: string; name: string;
} }
export interface AttributeValueEditDialogProps { export interface AttributeValueEditDialogProps {
attributeValue: AttributeDetails_attribute_values | null; attributeValue: AttributeValueEditDialogFormData | null;
confirmButtonState: ConfirmButtonTransitionState; confirmButtonState: ConfirmButtonTransitionState;
disabled: boolean; disabled: boolean;
errors: AttributeErrorFragment[]; errors: AttributeErrorFragment[];

View file

@ -3,6 +3,7 @@ import {
Card, Card,
IconButton, IconButton,
TableCell, TableCell,
TableFooter,
TableHead, TableHead,
TableRow TableRow
} from "@material-ui/core"; } from "@material-ui/core";
@ -14,16 +15,18 @@ import {
SortableTableBody, SortableTableBody,
SortableTableRow SortableTableRow
} from "@saleor/components/SortableTable"; } from "@saleor/components/SortableTable";
import { AttributeDetailsFragment_values } from "@saleor/fragments/types/AttributeDetailsFragment"; import TablePagination from "@saleor/components/TablePagination";
import { AttributeValueListFragment_edges_node } from "@saleor/fragments/types/AttributeValueListFragment";
import { maybe, renderCollection, stopPropagation } from "@saleor/misc"; import { maybe, renderCollection, stopPropagation } from "@saleor/misc";
import { makeStyles } from "@saleor/theme"; import { makeStyles } from "@saleor/theme";
import { ReorderAction } from "@saleor/types"; import { ListProps, ReorderAction } from "@saleor/types";
import React from "react"; import React from "react";
import { FormattedMessage, useIntl } from "react-intl"; import { FormattedMessage, useIntl } from "react-intl";
export interface AttributeValuesProps { export interface AttributeValuesProps
extends Pick<ListProps, Exclude<keyof ListProps, "onRowClick">> {
disabled: boolean; disabled: boolean;
values: AttributeDetailsFragment_values[]; values: AttributeValueListFragment_edges_node[];
onValueAdd: () => void; onValueAdd: () => void;
onValueDelete: (id: string) => void; onValueDelete: (id: string) => void;
onValueReorder: ReorderAction; onValueReorder: ReorderAction;
@ -57,13 +60,20 @@ const useStyles = makeStyles(
{ name: "AttributeValues" } { name: "AttributeValues" }
); );
const numberOfColumns = 4;
const AttributeValues: React.FC<AttributeValuesProps> = ({ const AttributeValues: React.FC<AttributeValuesProps> = ({
disabled, disabled,
onValueAdd, onValueAdd,
onValueDelete, onValueDelete,
onValueReorder, onValueReorder,
onValueUpdate, onValueUpdate,
values values,
settings,
onUpdateListSettings,
pageInfo,
onNextPage,
onPreviousPage
}) => { }) => {
const classes = useStyles({}); const classes = useStyles({});
const intl = useIntl(); const intl = useIntl();
@ -103,6 +113,21 @@ const AttributeValues: React.FC<AttributeValuesProps> = ({
<TableCell className={classes.iconCell} /> <TableCell className={classes.iconCell} />
</TableRow> </TableRow>
</TableHead> </TableHead>
<TableFooter>
<TableRow>
<TablePagination
colSpan={numberOfColumns}
hasNextPage={pageInfo && !disabled ? pageInfo.hasNextPage : false}
onNextPage={onNextPage}
hasPreviousPage={
pageInfo && !disabled ? pageInfo.hasPreviousPage : false
}
onPreviousPage={onPreviousPage}
settings={settings}
onUpdateListSettings={onUpdateListSettings}
/>
</TableRow>
</TableFooter>
<SortableTableBody onSortEnd={onValueReorder}> <SortableTableBody onSortEnd={onValueReorder}>
{renderCollection( {renderCollection(
values, values,

View file

@ -1,13 +1,13 @@
import { AttributeDetailsFragment } from "@saleor/fragments/types/AttributeDetailsFragment";
import { ProductDetails_product_productType_variantAttributes } from "@saleor/products/types/ProductDetails"; import { ProductDetails_product_productType_variantAttributes } from "@saleor/products/types/ProductDetails";
import { import {
AttributeInputTypeEnum, AttributeInputTypeEnum,
AttributeTypeEnum AttributeTypeEnum
} from "@saleor/types/globalTypes"; } from "@saleor/types/globalTypes";
import { AttributeDetails_attribute } from "./types/AttributeDetails";
import { AttributeList_attributes_edges_node } from "./types/AttributeList"; import { AttributeList_attributes_edges_node } from "./types/AttributeList";
export const attribute: AttributeDetailsFragment = { export const attribute: AttributeDetails_attribute = {
__typename: "Attribute" as "Attribute", __typename: "Attribute" as "Attribute",
availableInGrid: true, availableInGrid: true,
entityType: null, entityType: null,
@ -29,8 +29,20 @@ export const attribute: AttributeDetailsFragment = {
type: AttributeTypeEnum.PRODUCT_TYPE, type: AttributeTypeEnum.PRODUCT_TYPE,
valueRequired: true, valueRequired: true,
unit: null, unit: null,
values: [ choices: {
__typename: "AttributeValueCountableConnection" as "AttributeValueCountableConnection",
pageInfo: {
__typename: "PageInfo" as "PageInfo",
endCursor: "",
hasNextPage: false,
hasPreviousPage: false,
startCursor: ""
},
edges: [
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "1",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjI0", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjI0",
@ -38,8 +50,12 @@ export const attribute: AttributeDetailsFragment = {
reference: null, reference: null,
slug: "john-doe", slug: "john-doe",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "2",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjI1", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjI1",
@ -48,7 +64,9 @@ export const attribute: AttributeDetailsFragment = {
slug: "milionare-pirate", slug: "milionare-pirate",
richText: null richText: null
} }
], }
]
},
visibleInStorefront: true visibleInStorefront: true
}; };
@ -64,8 +82,20 @@ export const attributes: Array<AttributeList_attributes_edges_node &
slug: "author", slug: "author",
type: AttributeTypeEnum.PRODUCT_TYPE, type: AttributeTypeEnum.PRODUCT_TYPE,
unit: null, unit: null,
values: [ choices: {
__typename: "AttributeValueCountableConnection" as "AttributeValueCountableConnection",
pageInfo: {
endCursor: "WyI4IiwgIjMiXQ==",
hasNextPage: false,
hasPreviousPage: false,
startCursor: "WyIwIiwgIjQ5Il0=",
__typename: "PageInfo" as "PageInfo"
},
edges: [
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjI0", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjI0",
@ -75,8 +105,12 @@ export const attributes: Array<AttributeList_attributes_edges_node &
sortOrder: 0, sortOrder: 0,
value: "", value: "",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjI1", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjI1",
@ -87,7 +121,9 @@ export const attributes: Array<AttributeList_attributes_edges_node &
value: "", value: "",
richText: null richText: null
} }
], }
]
},
visibleInStorefront: true visibleInStorefront: true
} }
}, },
@ -101,8 +137,20 @@ export const attributes: Array<AttributeList_attributes_edges_node &
slug: "box-size", slug: "box-size",
type: AttributeTypeEnum.PRODUCT_TYPE, type: AttributeTypeEnum.PRODUCT_TYPE,
unit: null, unit: null,
values: [ choices: {
__typename: "AttributeValueCountableConnection" as "AttributeValueCountableConnection",
pageInfo: {
endCursor: "WyI4IiwgIjMiXQ==",
hasNextPage: false,
hasPreviousPage: false,
startCursor: "WyIwIiwgIjQ5Il0=",
__typename: "PageInfo" as "PageInfo"
},
edges: [
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjE1", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjE1",
@ -112,8 +160,12 @@ export const attributes: Array<AttributeList_attributes_edges_node &
sortOrder: 0, sortOrder: 0,
value: "", value: "",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjE2", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjE2",
@ -123,8 +175,12 @@ export const attributes: Array<AttributeList_attributes_edges_node &
sortOrder: 1, sortOrder: 1,
value: "", value: "",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjE3", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjE3",
@ -134,8 +190,12 @@ export const attributes: Array<AttributeList_attributes_edges_node &
sortOrder: 2, sortOrder: 2,
value: "", value: "",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjE4", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjE4",
@ -146,7 +206,9 @@ export const attributes: Array<AttributeList_attributes_edges_node &
value: "", value: "",
richText: null richText: null
} }
], }
]
},
visibleInStorefront: false visibleInStorefront: false
} }
}, },
@ -160,8 +222,20 @@ export const attributes: Array<AttributeList_attributes_edges_node &
slug: "brand", slug: "brand",
type: AttributeTypeEnum.PRODUCT_TYPE, type: AttributeTypeEnum.PRODUCT_TYPE,
unit: null, unit: null,
values: [ choices: {
__typename: "AttributeValueCountableConnection" as "AttributeValueCountableConnection",
pageInfo: {
endCursor: "WyI4IiwgIjMiXQ==",
hasNextPage: false,
hasPreviousPage: false,
startCursor: "WyIwIiwgIjQ5Il0=",
__typename: "PageInfo" as "PageInfo"
},
edges: [
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjY=", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjY=",
@ -172,7 +246,9 @@ export const attributes: Array<AttributeList_attributes_edges_node &
value: "", value: "",
richText: null richText: null
} }
], }
]
},
visibleInStorefront: false visibleInStorefront: false
} }
}, },
@ -186,8 +262,20 @@ export const attributes: Array<AttributeList_attributes_edges_node &
slug: "candy-box-size", slug: "candy-box-size",
type: AttributeTypeEnum.PRODUCT_TYPE, type: AttributeTypeEnum.PRODUCT_TYPE,
unit: null, unit: null,
values: [ choices: {
__typename: "AttributeValueCountableConnection" as "AttributeValueCountableConnection",
pageInfo: {
endCursor: "WyI4IiwgIjMiXQ==",
hasNextPage: false,
hasPreviousPage: false,
startCursor: "WyIwIiwgIjQ5Il0=",
__typename: "PageInfo" as "PageInfo"
},
edges: [
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjIx", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjIx",
@ -197,8 +285,12 @@ export const attributes: Array<AttributeList_attributes_edges_node &
sortOrder: 0, sortOrder: 0,
value: "", value: "",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjIy", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjIy",
@ -208,8 +300,12 @@ export const attributes: Array<AttributeList_attributes_edges_node &
sortOrder: 1, sortOrder: 1,
value: "", value: "",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjIz", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjIz",
@ -220,7 +316,9 @@ export const attributes: Array<AttributeList_attributes_edges_node &
value: "", value: "",
richText: null richText: null
} }
], }
]
},
visibleInStorefront: false visibleInStorefront: false
} }
}, },
@ -234,8 +332,20 @@ export const attributes: Array<AttributeList_attributes_edges_node &
slug: "coffee-genre", slug: "coffee-genre",
type: AttributeTypeEnum.PRODUCT_TYPE, type: AttributeTypeEnum.PRODUCT_TYPE,
unit: null, unit: null,
values: [ choices: {
__typename: "AttributeValueCountableConnection" as "AttributeValueCountableConnection",
pageInfo: {
endCursor: "WyI4IiwgIjMiXQ==",
hasNextPage: false,
hasPreviousPage: false,
startCursor: "WyIwIiwgIjQ5Il0=",
__typename: "PageInfo" as "PageInfo"
},
edges: [
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjEz", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjEz",
@ -245,8 +355,12 @@ export const attributes: Array<AttributeList_attributes_edges_node &
sortOrder: 0, sortOrder: 0,
value: "", value: "",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjE0", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjE0",
@ -257,7 +371,9 @@ export const attributes: Array<AttributeList_attributes_edges_node &
value: "", value: "",
richText: null richText: null
} }
], }
]
},
visibleInStorefront: true visibleInStorefront: true
} }
}, },
@ -271,8 +387,20 @@ export const attributes: Array<AttributeList_attributes_edges_node &
slug: "collar", slug: "collar",
type: AttributeTypeEnum.PRODUCT_TYPE, type: AttributeTypeEnum.PRODUCT_TYPE,
unit: null, unit: null,
values: [ choices: {
__typename: "AttributeValueCountableConnection" as "AttributeValueCountableConnection",
pageInfo: {
endCursor: "WyI4IiwgIjMiXQ==",
hasNextPage: false,
hasPreviousPage: false,
startCursor: "WyIwIiwgIjQ5Il0=",
__typename: "PageInfo" as "PageInfo"
},
edges: [
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjM=", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjM=",
@ -282,8 +410,12 @@ export const attributes: Array<AttributeList_attributes_edges_node &
sortOrder: 0, sortOrder: 0,
value: "", value: "",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjQ=", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjQ=",
@ -293,8 +425,12 @@ export const attributes: Array<AttributeList_attributes_edges_node &
sortOrder: 1, sortOrder: 1,
value: "", value: "",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjU=", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjU=",
@ -305,7 +441,9 @@ export const attributes: Array<AttributeList_attributes_edges_node &
value: "", value: "",
richText: null richText: null
} }
], }
]
},
visibleInStorefront: true visibleInStorefront: true
} }
}, },
@ -319,8 +457,20 @@ export const attributes: Array<AttributeList_attributes_edges_node &
slug: "color", slug: "color",
type: AttributeTypeEnum.PRODUCT_TYPE, type: AttributeTypeEnum.PRODUCT_TYPE,
unit: null, unit: null,
values: [ choices: {
__typename: "AttributeValueCountableConnection" as "AttributeValueCountableConnection",
pageInfo: {
endCursor: "WyI4IiwgIjMiXQ==",
hasNextPage: false,
hasPreviousPage: false,
startCursor: "WyIwIiwgIjQ5Il0=",
__typename: "PageInfo" as "PageInfo"
},
edges: [
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjE=", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjE=",
@ -330,8 +480,12 @@ export const attributes: Array<AttributeList_attributes_edges_node &
sortOrder: 0, sortOrder: 0,
value: "", value: "",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjI=", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjI=",
@ -342,7 +496,9 @@ export const attributes: Array<AttributeList_attributes_edges_node &
value: "", value: "",
richText: null richText: null
} }
], }
]
},
visibleInStorefront: true visibleInStorefront: true
} }
}, },
@ -356,8 +512,20 @@ export const attributes: Array<AttributeList_attributes_edges_node &
slug: "cover", slug: "cover",
type: AttributeTypeEnum.PRODUCT_TYPE, type: AttributeTypeEnum.PRODUCT_TYPE,
unit: null, unit: null,
values: [ choices: {
__typename: "AttributeValueCountableConnection" as "AttributeValueCountableConnection",
pageInfo: {
endCursor: "WyI4IiwgIjMiXQ==",
hasNextPage: false,
hasPreviousPage: false,
startCursor: "WyIwIiwgIjQ5Il0=",
__typename: "PageInfo" as "PageInfo"
},
edges: [
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjMw", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjMw",
@ -367,8 +535,12 @@ export const attributes: Array<AttributeList_attributes_edges_node &
sortOrder: 0, sortOrder: 0,
value: "", value: "",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjMx", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjMx",
@ -378,8 +550,12 @@ export const attributes: Array<AttributeList_attributes_edges_node &
sortOrder: 1, sortOrder: 1,
value: "", value: "",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjMy", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjMy",
@ -389,8 +565,12 @@ export const attributes: Array<AttributeList_attributes_edges_node &
sortOrder: 2, sortOrder: 2,
value: "", value: "",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjMz", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjMz",
@ -400,8 +580,12 @@ export const attributes: Array<AttributeList_attributes_edges_node &
sortOrder: 3, sortOrder: 3,
value: "", value: "",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjM0", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjM0",
@ -411,8 +595,12 @@ export const attributes: Array<AttributeList_attributes_edges_node &
sortOrder: 4, sortOrder: 4,
value: "", value: "",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjM1", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjM1",
@ -423,7 +611,9 @@ export const attributes: Array<AttributeList_attributes_edges_node &
value: "", value: "",
richText: null richText: null
} }
], }
]
},
visibleInStorefront: false visibleInStorefront: false
} }
}, },
@ -437,8 +627,20 @@ export const attributes: Array<AttributeList_attributes_edges_node &
slug: "flavor", slug: "flavor",
type: AttributeTypeEnum.PRODUCT_TYPE, type: AttributeTypeEnum.PRODUCT_TYPE,
unit: null, unit: null,
values: [ choices: {
__typename: "AttributeValueCountableConnection" as "AttributeValueCountableConnection",
pageInfo: {
endCursor: "WyI4IiwgIjMiXQ==",
hasNextPage: false,
hasPreviousPage: false,
startCursor: "WyIwIiwgIjQ5Il0=",
__typename: "PageInfo" as "PageInfo"
},
edges: [
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjE5", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjE5",
@ -448,8 +650,12 @@ export const attributes: Array<AttributeList_attributes_edges_node &
sortOrder: 0, sortOrder: 0,
value: "", value: "",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjIw", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjIw",
@ -460,7 +666,9 @@ export const attributes: Array<AttributeList_attributes_edges_node &
value: "", value: "",
richText: null richText: null
} }
], }
]
},
visibleInStorefront: true visibleInStorefront: true
} }
}, },
@ -474,8 +682,20 @@ export const attributes: Array<AttributeList_attributes_edges_node &
slug: "language", slug: "language",
type: AttributeTypeEnum.PRODUCT_TYPE, type: AttributeTypeEnum.PRODUCT_TYPE,
unit: null, unit: null,
values: [ choices: {
__typename: "AttributeValueCountableConnection" as "AttributeValueCountableConnection",
pageInfo: {
endCursor: "WyI4IiwgIjMiXQ==",
hasNextPage: false,
hasPreviousPage: false,
startCursor: "WyIwIiwgIjQ5Il0=",
__typename: "PageInfo" as "PageInfo"
},
edges: [
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjI4", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjI4",
@ -485,8 +705,12 @@ export const attributes: Array<AttributeList_attributes_edges_node &
sortOrder: 0, sortOrder: 0,
value: "", value: "",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjI5", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjI5",
@ -497,7 +721,9 @@ export const attributes: Array<AttributeList_attributes_edges_node &
value: "", value: "",
richText: null richText: null
} }
], }
]
},
visibleInStorefront: true visibleInStorefront: true
} }
}, },
@ -511,8 +737,20 @@ export const attributes: Array<AttributeList_attributes_edges_node &
slug: "publisher", slug: "publisher",
type: AttributeTypeEnum.PRODUCT_TYPE, type: AttributeTypeEnum.PRODUCT_TYPE,
unit: null, unit: null,
values: [ choices: {
__typename: "AttributeValueCountableConnection" as "AttributeValueCountableConnection",
pageInfo: {
endCursor: "WyI4IiwgIjMiXQ==",
hasNextPage: false,
hasPreviousPage: false,
startCursor: "WyIwIiwgIjQ5Il0=",
__typename: "PageInfo" as "PageInfo"
},
edges: [
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjI2", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjI2",
@ -522,8 +760,12 @@ export const attributes: Array<AttributeList_attributes_edges_node &
sortOrder: 0, sortOrder: 0,
value: "", value: "",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjI3", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjI3",
@ -534,7 +776,9 @@ export const attributes: Array<AttributeList_attributes_edges_node &
value: "", value: "",
richText: null richText: null
} }
], }
]
},
visibleInStorefront: true visibleInStorefront: true
} }
}, },
@ -548,8 +792,20 @@ export const attributes: Array<AttributeList_attributes_edges_node &
slug: "size", slug: "size",
type: AttributeTypeEnum.PRODUCT_TYPE, type: AttributeTypeEnum.PRODUCT_TYPE,
unit: null, unit: null,
values: [ choices: {
__typename: "AttributeValueCountableConnection" as "AttributeValueCountableConnection",
pageInfo: {
endCursor: "WyI4IiwgIjMiXQ==",
hasNextPage: false,
hasPreviousPage: false,
startCursor: "WyIwIiwgIjQ5Il0=",
__typename: "PageInfo" as "PageInfo"
},
edges: [
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjc=", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjc=",
@ -559,8 +815,12 @@ export const attributes: Array<AttributeList_attributes_edges_node &
sortOrder: 0, sortOrder: 0,
value: "", value: "",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjg=", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjg=",
@ -570,8 +830,12 @@ export const attributes: Array<AttributeList_attributes_edges_node &
sortOrder: 1, sortOrder: 1,
value: "", value: "",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjk=", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjk=",
@ -581,8 +845,12 @@ export const attributes: Array<AttributeList_attributes_edges_node &
sortOrder: 2, sortOrder: 2,
value: "", value: "",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjEw", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjEw",
@ -592,8 +860,12 @@ export const attributes: Array<AttributeList_attributes_edges_node &
sortOrder: 3, sortOrder: 3,
value: "", value: "",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjEx", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjEx",
@ -603,8 +875,12 @@ export const attributes: Array<AttributeList_attributes_edges_node &
sortOrder: 4, sortOrder: 4,
value: "", value: "",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjEy", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjEy",
@ -615,7 +891,9 @@ export const attributes: Array<AttributeList_attributes_edges_node &
value: "", value: "",
richText: null richText: null
} }
], }
]
},
visibleInStorefront: true visibleInStorefront: true
} }
} }

View file

@ -1,5 +1,9 @@
import { attributeDetailsFragment } from "@saleor/fragments/attributes"; import {
attributeDetailsFragment,
attributeValueListFragment
} from "@saleor/fragments/attributes";
import { attributeErrorFragment } from "@saleor/fragments/errors"; import { attributeErrorFragment } from "@saleor/fragments/errors";
import { pageInfoFragment } from "@saleor/fragments/pageInfo";
import makeMutation from "@saleor/hooks/makeMutation"; import makeMutation from "@saleor/hooks/makeMutation";
import gql from "graphql-tag"; import gql from "graphql-tag";
@ -86,12 +90,26 @@ export const useAttributeUpdateMutation = makeMutation<
>(attributeUpdateMutation); >(attributeUpdateMutation);
const attributeValueDelete = gql` const attributeValueDelete = gql`
${attributeDetailsFragment} ${attributeValueListFragment}
${attributeErrorFragment} ${attributeErrorFragment}
mutation AttributeValueDelete($id: ID!) { mutation AttributeValueDelete(
$id: ID!
$firstValues: Int
$afterValues: String
$lastValues: Int
$beforeValues: String
) {
attributeValueDelete(id: $id) { attributeValueDelete(id: $id) {
attribute { attribute {
...AttributeDetailsFragment id
choices(
first: $firstValues
after: $afterValues
last: $lastValues
before: $beforeValues
) {
...AttributeValueListFragment
}
} }
errors { errors {
...AttributeErrorFragment ...AttributeErrorFragment
@ -105,12 +123,27 @@ export const useAttributeValueDeleteMutation = makeMutation<
>(attributeValueDelete); >(attributeValueDelete);
export const attributeValueUpdateMutation = gql` export const attributeValueUpdateMutation = gql`
${attributeDetailsFragment} ${attributeValueListFragment}
${attributeErrorFragment} ${attributeErrorFragment}
mutation AttributeValueUpdate($id: ID!, $input: AttributeValueCreateInput!) { mutation AttributeValueUpdate(
$id: ID!
$input: AttributeValueCreateInput!
$firstValues: Int
$afterValues: String
$lastValues: Int
$beforeValues: String
) {
attributeValueUpdate(id: $id, input: $input) { attributeValueUpdate(id: $id, input: $input) {
attribute { attribute {
...AttributeDetailsFragment id
choices(
first: $firstValues
after: $afterValues
last: $lastValues
before: $beforeValues
) {
...AttributeValueListFragment
}
} }
errors { errors {
...AttributeErrorFragment ...AttributeErrorFragment
@ -124,12 +157,27 @@ export const useAttributeValueUpdateMutation = makeMutation<
>(attributeValueUpdateMutation); >(attributeValueUpdateMutation);
export const attributeValueCreateMutation = gql` export const attributeValueCreateMutation = gql`
${attributeDetailsFragment} ${attributeValueListFragment}
${attributeErrorFragment} ${attributeErrorFragment}
mutation AttributeValueCreate($id: ID!, $input: AttributeValueCreateInput!) { mutation AttributeValueCreate(
$id: ID!
$input: AttributeValueCreateInput!
$firstValues: Int
$afterValues: String
$lastValues: Int
$beforeValues: String
) {
attributeValueCreate(attribute: $id, input: $input) { attributeValueCreate(attribute: $id, input: $input) {
attribute { attribute {
...AttributeDetailsFragment id
choices(
first: $firstValues
after: $afterValues
last: $lastValues
before: $beforeValues
) {
...AttributeValueListFragment
}
} }
errors { errors {
...AttributeErrorFragment ...AttributeErrorFragment
@ -143,12 +191,11 @@ export const useAttributeValueCreateMutation = makeMutation<
>(attributeValueCreateMutation); >(attributeValueCreateMutation);
export const attributeCreateMutation = gql` export const attributeCreateMutation = gql`
${attributeDetailsFragment}
${attributeErrorFragment} ${attributeErrorFragment}
mutation AttributeCreate($input: AttributeCreateInput!) { mutation AttributeCreate($input: AttributeCreateInput!) {
attributeCreate(input: $input) { attributeCreate(input: $input) {
attribute { attribute {
...AttributeDetailsFragment id
} }
errors { errors {
...AttributeErrorFragment ...AttributeErrorFragment
@ -163,14 +210,35 @@ export const useAttributeCreateMutation = makeMutation<
const attributeValueReorderMutation = gql` const attributeValueReorderMutation = gql`
${attributeErrorFragment} ${attributeErrorFragment}
mutation AttributeValueReorder($id: ID!, $move: ReorderInput!) { ${pageInfoFragment}
mutation AttributeValueReorder(
$id: ID!
$move: ReorderInput!
$firstValues: Int
$afterValues: String
$lastValues: Int
$beforeValues: String
) {
attributeReorderValues(attributeId: $id, moves: [$move]) { attributeReorderValues(attributeId: $id, moves: [$move]) {
attribute { attribute {
id id
values { choices(
first: $firstValues
after: $afterValues
last: $lastValues
before: $beforeValues
) {
pageInfo {
...PageInfoFragment
}
edges {
cursor
node {
id id
} }
} }
}
}
errors { errors {
...AttributeErrorFragment ...AttributeErrorFragment
} }

View file

@ -1,6 +1,7 @@
import { import {
attributeDetailsFragment, attributeDetailsFragment,
attributeFragment attributeFragment,
attributeValueListFragment
} from "@saleor/fragments/attributes"; } from "@saleor/fragments/attributes";
import { pageInfoFragment } from "@saleor/fragments/pageInfo"; import { pageInfoFragment } from "@saleor/fragments/pageInfo";
import makeQuery from "@saleor/hooks/makeQuery"; import makeQuery from "@saleor/hooks/makeQuery";
@ -14,9 +15,24 @@ import { AttributeList, AttributeListVariables } from "./types/AttributeList";
const attributeDetails = gql` const attributeDetails = gql`
${attributeDetailsFragment} ${attributeDetailsFragment}
query AttributeDetails($id: ID!) { ${attributeValueListFragment}
query AttributeDetails(
$id: ID!
$firstValues: Int
$afterValues: String
$lastValues: Int
$beforeValues: String
) {
attribute(id: $id) { attribute(id: $id) {
...AttributeDetailsFragment ...AttributeDetailsFragment
choices(
first: $firstValues
after: $afterValues
last: $lastValues
before: $beforeValues
) {
...AttributeValueListFragment
}
} }
} }
`; `;
@ -47,11 +63,6 @@ const attributeList = gql`
edges { edges {
node { node {
...AttributeFragment ...AttributeFragment
values {
id
name
slug
}
} }
} }
pageInfo { pageInfo {

View file

@ -3,58 +3,15 @@
// @generated // @generated
// This file was automatically generated and should not be edited. // This file was automatically generated and should not be edited.
import { AttributeCreateInput, AttributeTypeEnum, MeasurementUnitsEnum, AttributeInputTypeEnum, AttributeEntityTypeEnum, AttributeErrorCode } from "./../../types/globalTypes"; import { AttributeCreateInput, AttributeErrorCode } from "./../../types/globalTypes";
// ==================================================== // ====================================================
// GraphQL mutation operation: AttributeCreate // GraphQL mutation operation: AttributeCreate
// ==================================================== // ====================================================
export interface AttributeCreate_attributeCreate_attribute_metadata {
__typename: "MetadataItem";
key: string;
value: string;
}
export interface AttributeCreate_attributeCreate_attribute_privateMetadata {
__typename: "MetadataItem";
key: string;
value: string;
}
export interface AttributeCreate_attributeCreate_attribute_values_file {
__typename: "File";
url: string;
contentType: string | null;
}
export interface AttributeCreate_attributeCreate_attribute_values {
__typename: "AttributeValue";
id: string;
name: string | null;
slug: string | null;
file: AttributeCreate_attributeCreate_attribute_values_file | null;
reference: string | null;
richText: any | null;
}
export interface AttributeCreate_attributeCreate_attribute { export interface AttributeCreate_attributeCreate_attribute {
__typename: "Attribute"; __typename: "Attribute";
id: string; id: string;
name: string | null;
slug: string | null;
type: AttributeTypeEnum | null;
visibleInStorefront: boolean;
filterableInDashboard: boolean;
filterableInStorefront: boolean;
unit: MeasurementUnitsEnum | null;
metadata: (AttributeCreate_attributeCreate_attribute_metadata | null)[];
privateMetadata: (AttributeCreate_attributeCreate_attribute_privateMetadata | null)[];
availableInGrid: boolean;
inputType: AttributeInputTypeEnum | null;
entityType: AttributeEntityTypeEnum | null;
storefrontSearchPosition: number;
valueRequired: boolean;
values: (AttributeCreate_attributeCreate_attribute_values | null)[] | null;
} }
export interface AttributeCreate_attributeCreate_errors { export interface AttributeCreate_attributeCreate_errors {

View file

@ -21,22 +21,42 @@ export interface AttributeDetails_attribute_privateMetadata {
value: string; value: string;
} }
export interface AttributeDetails_attribute_values_file { export interface AttributeDetails_attribute_choices_pageInfo {
__typename: "PageInfo";
endCursor: string | null;
hasNextPage: boolean;
hasPreviousPage: boolean;
startCursor: string | null;
}
export interface AttributeDetails_attribute_choices_edges_node_file {
__typename: "File"; __typename: "File";
url: string; url: string;
contentType: string | null; contentType: string | null;
} }
export interface AttributeDetails_attribute_values { export interface AttributeDetails_attribute_choices_edges_node {
__typename: "AttributeValue"; __typename: "AttributeValue";
id: string; id: string;
name: string | null; name: string | null;
slug: string | null; slug: string | null;
file: AttributeDetails_attribute_values_file | null; file: AttributeDetails_attribute_choices_edges_node_file | null;
reference: string | null; reference: string | null;
richText: any | null; richText: any | null;
} }
export interface AttributeDetails_attribute_choices_edges {
__typename: "AttributeValueCountableEdge";
cursor: string;
node: AttributeDetails_attribute_choices_edges_node;
}
export interface AttributeDetails_attribute_choices {
__typename: "AttributeValueCountableConnection";
pageInfo: AttributeDetails_attribute_choices_pageInfo;
edges: AttributeDetails_attribute_choices_edges[];
}
export interface AttributeDetails_attribute { export interface AttributeDetails_attribute {
__typename: "Attribute"; __typename: "Attribute";
id: string; id: string;
@ -54,7 +74,7 @@ export interface AttributeDetails_attribute {
entityType: AttributeEntityTypeEnum | null; entityType: AttributeEntityTypeEnum | null;
storefrontSearchPosition: number; storefrontSearchPosition: number;
valueRequired: boolean; valueRequired: boolean;
values: (AttributeDetails_attribute_values | null)[] | null; choices: AttributeDetails_attribute_choices | null;
} }
export interface AttributeDetails { export interface AttributeDetails {
@ -63,4 +83,8 @@ export interface AttributeDetails {
export interface AttributeDetailsVariables { export interface AttributeDetailsVariables {
id: string; id: string;
firstValues?: number | null;
afterValues?: string | null;
lastValues?: number | null;
beforeValues?: string | null;
} }

View file

@ -9,13 +9,6 @@ import { AttributeFilterInput, AttributeSortingInput, AttributeTypeEnum, Measure
// GraphQL query operation: AttributeList // GraphQL query operation: AttributeList
// ==================================================== // ====================================================
export interface AttributeList_attributes_edges_node_values {
__typename: "AttributeValue";
id: string;
name: string | null;
slug: string | null;
}
export interface AttributeList_attributes_edges_node { export interface AttributeList_attributes_edges_node {
__typename: "Attribute"; __typename: "Attribute";
id: string; id: string;
@ -26,7 +19,6 @@ export interface AttributeList_attributes_edges_node {
filterableInDashboard: boolean; filterableInDashboard: boolean;
filterableInStorefront: boolean; filterableInStorefront: boolean;
unit: MeasurementUnitsEnum | null; unit: MeasurementUnitsEnum | null;
values: (AttributeList_attributes_edges_node_values | null)[] | null;
} }
export interface AttributeList_attributes_edges { export interface AttributeList_attributes_edges {

View file

@ -21,22 +21,6 @@ export interface AttributeUpdate_attributeUpdate_attribute_privateMetadata {
value: string; value: string;
} }
export interface AttributeUpdate_attributeUpdate_attribute_values_file {
__typename: "File";
url: string;
contentType: string | null;
}
export interface AttributeUpdate_attributeUpdate_attribute_values {
__typename: "AttributeValue";
id: string;
name: string | null;
slug: string | null;
file: AttributeUpdate_attributeUpdate_attribute_values_file | null;
reference: string | null;
richText: any | null;
}
export interface AttributeUpdate_attributeUpdate_attribute { export interface AttributeUpdate_attributeUpdate_attribute {
__typename: "Attribute"; __typename: "Attribute";
id: string; id: string;
@ -54,7 +38,6 @@ export interface AttributeUpdate_attributeUpdate_attribute {
entityType: AttributeEntityTypeEnum | null; entityType: AttributeEntityTypeEnum | null;
storefrontSearchPosition: number; storefrontSearchPosition: number;
valueRequired: boolean; valueRequired: boolean;
values: (AttributeUpdate_attributeUpdate_attribute_values | null)[] | null;
} }
export interface AttributeUpdate_attributeUpdate_errors { export interface AttributeUpdate_attributeUpdate_errors {

View file

@ -3,58 +3,52 @@
// @generated // @generated
// This file was automatically generated and should not be edited. // This file was automatically generated and should not be edited.
import { AttributeValueCreateInput, AttributeTypeEnum, MeasurementUnitsEnum, AttributeInputTypeEnum, AttributeEntityTypeEnum, AttributeErrorCode } from "./../../types/globalTypes"; import { AttributeValueCreateInput, AttributeErrorCode } from "./../../types/globalTypes";
// ==================================================== // ====================================================
// GraphQL mutation operation: AttributeValueCreate // GraphQL mutation operation: AttributeValueCreate
// ==================================================== // ====================================================
export interface AttributeValueCreate_attributeValueCreate_attribute_metadata { export interface AttributeValueCreate_attributeValueCreate_attribute_choices_pageInfo {
__typename: "MetadataItem"; __typename: "PageInfo";
key: string; endCursor: string | null;
value: string; hasNextPage: boolean;
hasPreviousPage: boolean;
startCursor: string | null;
} }
export interface AttributeValueCreate_attributeValueCreate_attribute_privateMetadata { export interface AttributeValueCreate_attributeValueCreate_attribute_choices_edges_node_file {
__typename: "MetadataItem";
key: string;
value: string;
}
export interface AttributeValueCreate_attributeValueCreate_attribute_values_file {
__typename: "File"; __typename: "File";
url: string; url: string;
contentType: string | null; contentType: string | null;
} }
export interface AttributeValueCreate_attributeValueCreate_attribute_values { export interface AttributeValueCreate_attributeValueCreate_attribute_choices_edges_node {
__typename: "AttributeValue"; __typename: "AttributeValue";
id: string; id: string;
name: string | null; name: string | null;
slug: string | null; slug: string | null;
file: AttributeValueCreate_attributeValueCreate_attribute_values_file | null; file: AttributeValueCreate_attributeValueCreate_attribute_choices_edges_node_file | null;
reference: string | null; reference: string | null;
richText: any | null; richText: any | null;
} }
export interface AttributeValueCreate_attributeValueCreate_attribute_choices_edges {
__typename: "AttributeValueCountableEdge";
cursor: string;
node: AttributeValueCreate_attributeValueCreate_attribute_choices_edges_node;
}
export interface AttributeValueCreate_attributeValueCreate_attribute_choices {
__typename: "AttributeValueCountableConnection";
pageInfo: AttributeValueCreate_attributeValueCreate_attribute_choices_pageInfo;
edges: AttributeValueCreate_attributeValueCreate_attribute_choices_edges[];
}
export interface AttributeValueCreate_attributeValueCreate_attribute { export interface AttributeValueCreate_attributeValueCreate_attribute {
__typename: "Attribute"; __typename: "Attribute";
id: string; id: string;
name: string | null; choices: AttributeValueCreate_attributeValueCreate_attribute_choices | null;
slug: string | null;
type: AttributeTypeEnum | null;
visibleInStorefront: boolean;
filterableInDashboard: boolean;
filterableInStorefront: boolean;
unit: MeasurementUnitsEnum | null;
metadata: (AttributeValueCreate_attributeValueCreate_attribute_metadata | null)[];
privateMetadata: (AttributeValueCreate_attributeValueCreate_attribute_privateMetadata | null)[];
availableInGrid: boolean;
inputType: AttributeInputTypeEnum | null;
entityType: AttributeEntityTypeEnum | null;
storefrontSearchPosition: number;
valueRequired: boolean;
values: (AttributeValueCreate_attributeValueCreate_attribute_values | null)[] | null;
} }
export interface AttributeValueCreate_attributeValueCreate_errors { export interface AttributeValueCreate_attributeValueCreate_errors {
@ -76,4 +70,8 @@ export interface AttributeValueCreate {
export interface AttributeValueCreateVariables { export interface AttributeValueCreateVariables {
id: string; id: string;
input: AttributeValueCreateInput; input: AttributeValueCreateInput;
firstValues?: number | null;
afterValues?: string | null;
lastValues?: number | null;
beforeValues?: string | null;
} }

View file

@ -3,58 +3,52 @@
// @generated // @generated
// This file was automatically generated and should not be edited. // This file was automatically generated and should not be edited.
import { AttributeTypeEnum, MeasurementUnitsEnum, AttributeInputTypeEnum, AttributeEntityTypeEnum, AttributeErrorCode } from "./../../types/globalTypes"; import { AttributeErrorCode } from "./../../types/globalTypes";
// ==================================================== // ====================================================
// GraphQL mutation operation: AttributeValueDelete // GraphQL mutation operation: AttributeValueDelete
// ==================================================== // ====================================================
export interface AttributeValueDelete_attributeValueDelete_attribute_metadata { export interface AttributeValueDelete_attributeValueDelete_attribute_choices_pageInfo {
__typename: "MetadataItem"; __typename: "PageInfo";
key: string; endCursor: string | null;
value: string; hasNextPage: boolean;
hasPreviousPage: boolean;
startCursor: string | null;
} }
export interface AttributeValueDelete_attributeValueDelete_attribute_privateMetadata { export interface AttributeValueDelete_attributeValueDelete_attribute_choices_edges_node_file {
__typename: "MetadataItem";
key: string;
value: string;
}
export interface AttributeValueDelete_attributeValueDelete_attribute_values_file {
__typename: "File"; __typename: "File";
url: string; url: string;
contentType: string | null; contentType: string | null;
} }
export interface AttributeValueDelete_attributeValueDelete_attribute_values { export interface AttributeValueDelete_attributeValueDelete_attribute_choices_edges_node {
__typename: "AttributeValue"; __typename: "AttributeValue";
id: string; id: string;
name: string | null; name: string | null;
slug: string | null; slug: string | null;
file: AttributeValueDelete_attributeValueDelete_attribute_values_file | null; file: AttributeValueDelete_attributeValueDelete_attribute_choices_edges_node_file | null;
reference: string | null; reference: string | null;
richText: any | null; richText: any | null;
} }
export interface AttributeValueDelete_attributeValueDelete_attribute_choices_edges {
__typename: "AttributeValueCountableEdge";
cursor: string;
node: AttributeValueDelete_attributeValueDelete_attribute_choices_edges_node;
}
export interface AttributeValueDelete_attributeValueDelete_attribute_choices {
__typename: "AttributeValueCountableConnection";
pageInfo: AttributeValueDelete_attributeValueDelete_attribute_choices_pageInfo;
edges: AttributeValueDelete_attributeValueDelete_attribute_choices_edges[];
}
export interface AttributeValueDelete_attributeValueDelete_attribute { export interface AttributeValueDelete_attributeValueDelete_attribute {
__typename: "Attribute"; __typename: "Attribute";
id: string; id: string;
name: string | null; choices: AttributeValueDelete_attributeValueDelete_attribute_choices | null;
slug: string | null;
type: AttributeTypeEnum | null;
visibleInStorefront: boolean;
filterableInDashboard: boolean;
filterableInStorefront: boolean;
unit: MeasurementUnitsEnum | null;
metadata: (AttributeValueDelete_attributeValueDelete_attribute_metadata | null)[];
privateMetadata: (AttributeValueDelete_attributeValueDelete_attribute_privateMetadata | null)[];
availableInGrid: boolean;
inputType: AttributeInputTypeEnum | null;
entityType: AttributeEntityTypeEnum | null;
storefrontSearchPosition: number;
valueRequired: boolean;
values: (AttributeValueDelete_attributeValueDelete_attribute_values | null)[] | null;
} }
export interface AttributeValueDelete_attributeValueDelete_errors { export interface AttributeValueDelete_attributeValueDelete_errors {
@ -75,4 +69,8 @@ export interface AttributeValueDelete {
export interface AttributeValueDeleteVariables { export interface AttributeValueDeleteVariables {
id: string; id: string;
firstValues?: number | null;
afterValues?: string | null;
lastValues?: number | null;
beforeValues?: string | null;
} }

View file

@ -9,15 +9,35 @@ import { ReorderInput, AttributeErrorCode } from "./../../types/globalTypes";
// GraphQL mutation operation: AttributeValueReorder // GraphQL mutation operation: AttributeValueReorder
// ==================================================== // ====================================================
export interface AttributeValueReorder_attributeReorderValues_attribute_values { export interface AttributeValueReorder_attributeReorderValues_attribute_choices_pageInfo {
__typename: "PageInfo";
endCursor: string | null;
hasNextPage: boolean;
hasPreviousPage: boolean;
startCursor: string | null;
}
export interface AttributeValueReorder_attributeReorderValues_attribute_choices_edges_node {
__typename: "AttributeValue"; __typename: "AttributeValue";
id: string; id: string;
} }
export interface AttributeValueReorder_attributeReorderValues_attribute_choices_edges {
__typename: "AttributeValueCountableEdge";
cursor: string;
node: AttributeValueReorder_attributeReorderValues_attribute_choices_edges_node;
}
export interface AttributeValueReorder_attributeReorderValues_attribute_choices {
__typename: "AttributeValueCountableConnection";
pageInfo: AttributeValueReorder_attributeReorderValues_attribute_choices_pageInfo;
edges: AttributeValueReorder_attributeReorderValues_attribute_choices_edges[];
}
export interface AttributeValueReorder_attributeReorderValues_attribute { export interface AttributeValueReorder_attributeReorderValues_attribute {
__typename: "Attribute"; __typename: "Attribute";
id: string; id: string;
values: (AttributeValueReorder_attributeReorderValues_attribute_values | null)[] | null; choices: AttributeValueReorder_attributeReorderValues_attribute_choices | null;
} }
export interface AttributeValueReorder_attributeReorderValues_errors { export interface AttributeValueReorder_attributeReorderValues_errors {
@ -39,4 +59,8 @@ export interface AttributeValueReorder {
export interface AttributeValueReorderVariables { export interface AttributeValueReorderVariables {
id: string; id: string;
move: ReorderInput; move: ReorderInput;
firstValues?: number | null;
afterValues?: string | null;
lastValues?: number | null;
beforeValues?: string | null;
} }

View file

@ -3,58 +3,52 @@
// @generated // @generated
// This file was automatically generated and should not be edited. // This file was automatically generated and should not be edited.
import { AttributeValueCreateInput, AttributeTypeEnum, MeasurementUnitsEnum, AttributeInputTypeEnum, AttributeEntityTypeEnum, AttributeErrorCode } from "./../../types/globalTypes"; import { AttributeValueCreateInput, AttributeErrorCode } from "./../../types/globalTypes";
// ==================================================== // ====================================================
// GraphQL mutation operation: AttributeValueUpdate // GraphQL mutation operation: AttributeValueUpdate
// ==================================================== // ====================================================
export interface AttributeValueUpdate_attributeValueUpdate_attribute_metadata { export interface AttributeValueUpdate_attributeValueUpdate_attribute_choices_pageInfo {
__typename: "MetadataItem"; __typename: "PageInfo";
key: string; endCursor: string | null;
value: string; hasNextPage: boolean;
hasPreviousPage: boolean;
startCursor: string | null;
} }
export interface AttributeValueUpdate_attributeValueUpdate_attribute_privateMetadata { export interface AttributeValueUpdate_attributeValueUpdate_attribute_choices_edges_node_file {
__typename: "MetadataItem";
key: string;
value: string;
}
export interface AttributeValueUpdate_attributeValueUpdate_attribute_values_file {
__typename: "File"; __typename: "File";
url: string; url: string;
contentType: string | null; contentType: string | null;
} }
export interface AttributeValueUpdate_attributeValueUpdate_attribute_values { export interface AttributeValueUpdate_attributeValueUpdate_attribute_choices_edges_node {
__typename: "AttributeValue"; __typename: "AttributeValue";
id: string; id: string;
name: string | null; name: string | null;
slug: string | null; slug: string | null;
file: AttributeValueUpdate_attributeValueUpdate_attribute_values_file | null; file: AttributeValueUpdate_attributeValueUpdate_attribute_choices_edges_node_file | null;
reference: string | null; reference: string | null;
richText: any | null; richText: any | null;
} }
export interface AttributeValueUpdate_attributeValueUpdate_attribute_choices_edges {
__typename: "AttributeValueCountableEdge";
cursor: string;
node: AttributeValueUpdate_attributeValueUpdate_attribute_choices_edges_node;
}
export interface AttributeValueUpdate_attributeValueUpdate_attribute_choices {
__typename: "AttributeValueCountableConnection";
pageInfo: AttributeValueUpdate_attributeValueUpdate_attribute_choices_pageInfo;
edges: AttributeValueUpdate_attributeValueUpdate_attribute_choices_edges[];
}
export interface AttributeValueUpdate_attributeValueUpdate_attribute { export interface AttributeValueUpdate_attributeValueUpdate_attribute {
__typename: "Attribute"; __typename: "Attribute";
id: string; id: string;
name: string | null; choices: AttributeValueUpdate_attributeValueUpdate_attribute_choices | null;
slug: string | null;
type: AttributeTypeEnum | null;
visibleInStorefront: boolean;
filterableInDashboard: boolean;
filterableInStorefront: boolean;
unit: MeasurementUnitsEnum | null;
metadata: (AttributeValueUpdate_attributeValueUpdate_attribute_metadata | null)[];
privateMetadata: (AttributeValueUpdate_attributeValueUpdate_attribute_privateMetadata | null)[];
availableInGrid: boolean;
inputType: AttributeInputTypeEnum | null;
entityType: AttributeEntityTypeEnum | null;
storefrontSearchPosition: number;
valueRequired: boolean;
values: (AttributeValueUpdate_attributeValueUpdate_attribute_values | null)[] | null;
} }
export interface AttributeValueUpdate_attributeValueUpdate_errors { export interface AttributeValueUpdate_attributeValueUpdate_errors {
@ -76,4 +70,8 @@ export interface AttributeValueUpdate {
export interface AttributeValueUpdateVariables { export interface AttributeValueUpdateVariables {
id: string; id: string;
input: AttributeValueCreateInput; input: AttributeValueCreateInput;
firstValues?: number | null;
afterValues?: string | null;
lastValues?: number | null;
beforeValues?: string | null;
} }

View file

@ -96,6 +96,7 @@ export const isFileValueUnused = (
attributesWithNewFileValue: FormsetData<null, File>, attributesWithNewFileValue: FormsetData<null, File>,
existingAttribute: existingAttribute:
| PageDetails_page_attributes | PageDetails_page_attributes
| ProductDetails_product_attributes
| SelectedVariantAttributeFragment | SelectedVariantAttributeFragment
) => { ) => {
if (existingAttribute.attribute.inputType !== AttributeInputTypeEnum.FILE) { if (existingAttribute.attribute.inputType !== AttributeInputTypeEnum.FILE) {

View file

@ -12,6 +12,8 @@ import {
FormsetData FormsetData
} from "@saleor/hooks/useFormset"; } from "@saleor/hooks/useFormset";
import { PageDetails_page_attributes } from "@saleor/pages/types/PageDetails"; import { PageDetails_page_attributes } from "@saleor/pages/types/PageDetails";
import { ProductDetails_product_attributes } from "@saleor/products/types/ProductDetails";
import { ProductVariantDetails_productVariant_nonSelectionAttributes } from "@saleor/products/types/ProductVariantDetails";
import { FetchMoreProps, ReorderEvent } from "@saleor/types"; import { FetchMoreProps, ReorderEvent } from "@saleor/types";
import { import {
AttributeEntityTypeEnum, AttributeEntityTypeEnum,
@ -232,7 +234,11 @@ export const handleUploadMultipleFiles = async (
export const handleDeleteMultipleAttributeValues = async ( export const handleDeleteMultipleAttributeValues = async (
attributesWithNewFileValue: FormsetData<null, File>, attributesWithNewFileValue: FormsetData<null, File>,
attributes: PageDetails_page_attributes[], attributes: Array<
| PageDetails_page_attributes
| ProductDetails_product_attributes
| ProductVariantDetails_productVariant_nonSelectionAttributes
>,
deleteAttributeValue: ( deleteAttributeValue: (
variables: AttributeValueDeleteVariables variables: AttributeValueDeleteVariables
) => Promise<MutationFetchResult<AttributeValueDelete>> ) => Promise<MutationFetchResult<AttributeValueDelete>>

View file

@ -1,9 +1,11 @@
import { getAttributeData } from "@saleor/attributes/utils/data"; import { getAttributeData } from "@saleor/attributes/utils/data";
import { AttributeErrorFragment } from "@saleor/fragments/types/AttributeErrorFragment"; import { AttributeErrorFragment } from "@saleor/fragments/types/AttributeErrorFragment";
import useListSettings from "@saleor/hooks/useListSettings";
import useLocalPageInfo, { getMaxPage } from "@saleor/hooks/useLocalPageInfo";
import useNavigator from "@saleor/hooks/useNavigator"; import useNavigator from "@saleor/hooks/useNavigator";
import useNotifier from "@saleor/hooks/useNotifier"; import useNotifier from "@saleor/hooks/useNotifier";
import { getStringOrPlaceholder } from "@saleor/misc"; import { getStringOrPlaceholder } from "@saleor/misc";
import { ReorderEvent } from "@saleor/types"; import { ListViews, ReorderEvent } from "@saleor/types";
import { AttributeErrorCode } from "@saleor/types/globalTypes"; import { AttributeErrorCode } from "@saleor/types/globalTypes";
import createDialogActionHandlers from "@saleor/utils/handlers/dialogActionHandlers"; import createDialogActionHandlers from "@saleor/utils/handlers/dialogActionHandlers";
import createMetadataCreateHandler from "@saleor/utils/handlers/metadataCreateHandler"; import createMetadataCreateHandler from "@saleor/utils/handlers/metadataCreateHandler";
@ -67,6 +69,18 @@ const AttributeDetails: React.FC<AttributeDetailsProps> = ({ params }) => {
AttributeErrorFragment[] AttributeErrorFragment[]
>([]); >([]);
const { updateListSettings, settings } = useListSettings(
ListViews.ATTRIBUTE_VALUE_LIST
);
const {
pageInfo,
pageValues,
loadNextPage,
loadPreviousPage,
loadPage
} = useLocalPageInfo(values, settings?.rowNumber);
const [attributeCreate, attributeCreateOpts] = useAttributeCreateMutation({ const [attributeCreate, attributeCreateOpts] = useAttributeCreateMutation({
onCompleted: data => { onCompleted: data => {
if (data.attributeCreate.errors.length === 0) { if (data.attributeCreate.errors.length === 0) {
@ -83,7 +97,9 @@ const AttributeDetails: React.FC<AttributeDetailsProps> = ({ params }) => {
const [updateMetadata] = useMetadataUpdate({}); const [updateMetadata] = useMetadataUpdate({});
const [updatePrivateMetadata] = usePrivateMetadataUpdate({}); const [updatePrivateMetadata] = usePrivateMetadataUpdate({});
const id = params.id ? parseInt(params.id, 0) : undefined; const id = params.id
? parseInt(params.id, 0) + pageInfo.startCursor
: undefined;
const [openModal, closeModal] = createDialogActionHandlers< const [openModal, closeModal] = createDialogActionHandlers<
AttributeAddUrlDialog, AttributeAddUrlDialog,
@ -93,7 +109,8 @@ const AttributeDetails: React.FC<AttributeDetailsProps> = ({ params }) => {
React.useEffect(() => setValueErrors([]), [params.action]); React.useEffect(() => setValueErrors([]), [params.action]);
const handleValueDelete = () => { const handleValueDelete = () => {
setValues(remove(values[params.id], values, areValuesEqual)); const newValues = remove(values[id], values, areValuesEqual);
setValues(newValues);
closeModal(); closeModal();
}; };
const handleValueUpdate = (input: AttributeValueEditDialogFormData) => { const handleValueUpdate = (input: AttributeValueEditDialogFormData) => {
@ -108,12 +125,26 @@ const AttributeDetails: React.FC<AttributeDetailsProps> = ({ params }) => {
if (isSelected(input, values, areValuesEqual)) { if (isSelected(input, values, areValuesEqual)) {
setValueErrors([attributeValueAlreadyExistsError]); setValueErrors([attributeValueAlreadyExistsError]);
} else { } else {
setValues(add(input, values)); const newValues = add(input, values);
setValues(newValues);
const addedToNotVisibleLastPage =
newValues.length - pageInfo.startCursor > settings.rowNumber;
if (addedToNotVisibleLastPage) {
const maxPage = getMaxPage(newValues.length, settings.rowNumber);
loadPage(maxPage);
}
closeModal(); closeModal();
} }
}; };
const handleValueReorder = ({ newIndex, oldIndex }: ReorderEvent) => const handleValueReorder = ({ newIndex, oldIndex }: ReorderEvent) =>
setValues(move(values[oldIndex], values, areValuesEqual, newIndex)); setValues(
move(
values[pageInfo.startCursor + oldIndex],
values,
areValuesEqual,
pageInfo.startCursor + newIndex
)
);
const handleCreate = async (data: AttributePageFormData) => { const handleCreate = async (data: AttributePageFormData) => {
const input = getAttributeData(data, values); const input = getAttributeData(data, values);
@ -154,7 +185,19 @@ const AttributeDetails: React.FC<AttributeDetailsProps> = ({ params }) => {
}) })
} }
saveButtonBarState={attributeCreateOpts.status} saveButtonBarState={attributeCreateOpts.status}
values={values.map((value, valueIndex) => ({ values={{
__typename: "AttributeValueCountableConnection" as "AttributeValueCountableConnection",
pageInfo: {
__typename: "PageInfo" as "PageInfo",
endCursor: "",
hasNextPage: false,
hasPreviousPage: false,
startCursor: ""
},
edges: pageValues.map((value, valueIndex) => ({
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "1",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: valueIndex.toString(), id: valueIndex.toString(),
@ -164,7 +207,14 @@ const AttributeDetails: React.FC<AttributeDetailsProps> = ({ params }) => {
value: null, value: null,
richText: null, richText: null,
...value ...value
}))} }
}))
}}
settings={settings}
onUpdateListSettings={updateListSettings}
pageInfo={pageInfo}
onNextPage={loadNextPage}
onPreviousPage={loadPreviousPage}
/> />
<AttributeValueEditDialog <AttributeValueEditDialog
attributeValue={null} attributeValue={null}
@ -186,7 +236,7 @@ const AttributeDetails: React.FC<AttributeDetailsProps> = ({ params }) => {
onConfirm={handleValueDelete} onConfirm={handleValueDelete}
/> />
<AttributeValueEditDialog <AttributeValueEditDialog
attributeValue={values[params.id]} attributeValue={values[id]}
confirmButtonState="default" confirmButtonState="default"
disabled={false} disabled={false}
errors={valueErrors} errors={valueErrors}

View file

@ -1,8 +1,12 @@
import useListSettings from "@saleor/hooks/useListSettings";
import useLocalPaginator, {
useLocalPaginationState
} from "@saleor/hooks/useLocalPaginator";
import useNavigator from "@saleor/hooks/useNavigator"; import useNavigator from "@saleor/hooks/useNavigator";
import useNotifier from "@saleor/hooks/useNotifier"; import useNotifier from "@saleor/hooks/useNotifier";
import { commonMessages } from "@saleor/intl"; import { commonMessages } from "@saleor/intl";
import { maybe } from "@saleor/misc"; import { maybe } from "@saleor/misc";
import { ReorderEvent } from "@saleor/types"; import { ListViews, ReorderEvent } from "@saleor/types";
import getAttributeErrorMessage from "@saleor/utils/errors/attribute"; import getAttributeErrorMessage from "@saleor/utils/errors/attribute";
import createDialogActionHandlers from "@saleor/utils/handlers/dialogActionHandlers"; import createDialogActionHandlers from "@saleor/utils/handlers/dialogActionHandlers";
import createMetadataUpdateHandler from "@saleor/utils/handlers/metadataUpdateHandler"; import createMetadataUpdateHandler from "@saleor/utils/handlers/metadataUpdateHandler";
@ -53,12 +57,32 @@ const AttributeDetails: React.FC<AttributeDetailsProps> = ({ id, params }) => {
AttributeUrlQueryParams AttributeUrlQueryParams
>(navigate, params => attributeUrl(id, params), params); >(navigate, params => attributeUrl(id, params), params);
const { updateListSettings, settings } = useListSettings(
ListViews.ATTRIBUTE_VALUE_LIST
);
const [
valuesPaginationState,
setValuesPaginationState
] = useLocalPaginationState(settings?.rowNumber);
const { data, loading } = useAttributeDetailsQuery({ const { data, loading } = useAttributeDetailsQuery({
variables: { variables: {
id id,
} firstValues: valuesPaginationState.first,
lastValues: valuesPaginationState.last,
afterValues: valuesPaginationState.after,
beforeValues: valuesPaginationState.before
},
skip: !settings
}); });
const paginateValues = useLocalPaginator(setValuesPaginationState);
const { loadNextPage, loadPreviousPage, pageInfo } = paginateValues(
data?.attribute?.choices?.pageInfo,
valuesPaginationState
);
const [attributeDelete, attributeDeleteOpts] = useAttributeDeleteMutation({ const [attributeDelete, attributeDeleteOpts] = useAttributeDeleteMutation({
onCompleted: data => { onCompleted: data => {
if (data.attributeDelete.errors.length === 0) { if (data.attributeDelete.errors.length === 0) {
@ -156,12 +180,18 @@ const AttributeDetails: React.FC<AttributeDetailsProps> = ({ id, params }) => {
__typename: "AttributeReorderValues", __typename: "AttributeReorderValues",
attribute: { attribute: {
...data.attribute, ...data.attribute,
values: move( choices: {
data.attribute.values[oldIndex], __typename: "AttributeValueCountableConnection",
data.attribute.values, pageInfo: {
(a, b) => a.id === b.id, ...data.attribute.choices.pageInfo
},
edges: move(
data.attribute.choices.edges[oldIndex],
data.attribute.choices.edges,
(a, b) => a.node.id === b.node.id,
newIndex newIndex
) )
}
}, },
errors: [] errors: []
} }
@ -169,9 +199,13 @@ const AttributeDetails: React.FC<AttributeDetailsProps> = ({ id, params }) => {
variables: { variables: {
id, id,
move: { move: {
id: data.attribute.values[oldIndex].id, id: data.attribute.choices.edges[oldIndex].node.id,
sortOrder: newIndex - oldIndex sortOrder: newIndex - oldIndex
} },
firstValues: valuesPaginationState.first,
lastValues: valuesPaginationState.last,
afterValues: valuesPaginationState.after,
beforeValues: valuesPaginationState.before
} }
}); });
@ -224,7 +258,12 @@ const AttributeDetails: React.FC<AttributeDetailsProps> = ({ id, params }) => {
}) })
} }
saveButtonBarState={attributeUpdateOpts.status} saveButtonBarState={attributeUpdateOpts.status}
values={maybe(() => data.attribute.values)} values={maybe(() => data.attribute.choices)}
settings={settings}
onUpdateListSettings={updateListSettings}
pageInfo={pageInfo}
onNextPage={loadNextPage}
onPreviousPage={loadPreviousPage}
/> />
<AttributeDeleteDialog <AttributeDeleteDialog
open={params.action === "remove"} open={params.action === "remove"}
@ -244,7 +283,9 @@ const AttributeDetails: React.FC<AttributeDetailsProps> = ({ id, params }) => {
open={params.action === "remove-value"} open={params.action === "remove-value"}
name={maybe( name={maybe(
() => () =>
data.attribute.values.find(value => params.id === value.id).name, data.attribute.choices.edges.find(
value => params.id === value.node.id
).node.name,
"..." "..."
)} )}
useName={true} useName={true}
@ -253,7 +294,11 @@ const AttributeDetails: React.FC<AttributeDetailsProps> = ({ id, params }) => {
onConfirm={() => onConfirm={() =>
attributeValueDelete({ attributeValueDelete({
variables: { variables: {
id: params.id id: params.id,
firstValues: valuesPaginationState.first,
lastValues: valuesPaginationState.last,
afterValues: valuesPaginationState.after,
beforeValues: valuesPaginationState.before
} }
}) })
} }
@ -271,14 +316,21 @@ const AttributeDetails: React.FC<AttributeDetailsProps> = ({ id, params }) => {
attributeValueCreate({ attributeValueCreate({
variables: { variables: {
id, id,
input input,
firstValues: valuesPaginationState.first,
lastValues: valuesPaginationState.last,
afterValues: valuesPaginationState.after,
beforeValues: valuesPaginationState.before
} }
}) })
} }
/> />
<AttributeValueEditDialog <AttributeValueEditDialog
attributeValue={maybe(() => attributeValue={maybe(
data.attribute.values.find(value => params.id === value.id) () =>
data.attribute.choices.edges.find(
value => params.id === value.node.id
).node
)} )}
confirmButtonState={attributeValueUpdateOpts.status} confirmButtonState={attributeValueUpdateOpts.status}
disabled={loading} disabled={loading}
@ -290,9 +342,14 @@ const AttributeDetails: React.FC<AttributeDetailsProps> = ({ id, params }) => {
onSubmit={input => onSubmit={input =>
attributeValueUpdate({ attributeValueUpdate({
variables: { variables: {
id: data.attribute.values.find(value => params.id === value.id) id: data.attribute.choices.edges.find(
.id, value => params.id === value.node.id
input ).node.id,
input,
firstValues: valuesPaginationState.first,
lastValues: valuesPaginationState.last,
afterValues: valuesPaginationState.after,
beforeValues: valuesPaginationState.before
} }
}) })
} }

View file

@ -11,17 +11,19 @@ import {
getMultiDisplayValue, getMultiDisplayValue,
getReferenceDisplayValue, getReferenceDisplayValue,
getRichTextData, getRichTextData,
getSingleChoices getSingleChoices,
getSingleDisplayValue
} from "@saleor/components/Attributes/utils"; } from "@saleor/components/Attributes/utils";
import FileUploadField from "@saleor/components/FileUploadField"; import FileUploadField from "@saleor/components/FileUploadField";
import MultiAutocompleteSelectField from "@saleor/components/MultiAutocompleteSelectField"; import MultiAutocompleteSelectField from "@saleor/components/MultiAutocompleteSelectField";
import RichTextEditor from "@saleor/components/RichTextEditor"; import RichTextEditor from "@saleor/components/RichTextEditor";
import SingleAutocompleteSelectField from "@saleor/components/SingleAutocompleteSelectField"; import SingleAutocompleteSelectField from "@saleor/components/SingleAutocompleteSelectField";
import SortableChipsField from "@saleor/components/SortableChipsField"; import SortableChipsField from "@saleor/components/SortableChipsField";
import { AttributeValueFragment } from "@saleor/fragments/types/AttributeValueFragment";
import { PageErrorWithAttributesFragment } from "@saleor/fragments/types/PageErrorWithAttributesFragment"; import { PageErrorWithAttributesFragment } from "@saleor/fragments/types/PageErrorWithAttributesFragment";
import { ProductErrorWithAttributesFragment } from "@saleor/fragments/types/ProductErrorWithAttributesFragment"; import { ProductErrorWithAttributesFragment } from "@saleor/fragments/types/ProductErrorWithAttributesFragment";
import { FormsetChange } from "@saleor/hooks/useFormset"; import { FormsetChange } from "@saleor/hooks/useFormset";
import { ReorderEvent } from "@saleor/types"; import { FetchMoreProps, ReorderEvent } from "@saleor/types";
import { AttributeInputTypeEnum } from "@saleor/types/globalTypes"; import { AttributeInputTypeEnum } from "@saleor/types/globalTypes";
import React from "react"; import React from "react";
import { defineMessages, useIntl } from "react-intl"; import { defineMessages, useIntl } from "react-intl";
@ -53,10 +55,14 @@ export interface AttributeRowHandlers {
onReferencesAddClick: (attribute: AttributeInput) => void; onReferencesAddClick: (attribute: AttributeInput) => void;
onReferencesRemove: FormsetChange<string[]>; onReferencesRemove: FormsetChange<string[]>;
onReferencesReorder: FormsetChange<ReorderEvent>; onReferencesReorder: FormsetChange<ReorderEvent>;
fetchAttributeValues: (query: string) => void;
fetchMoreAttributeValues: FetchMoreProps;
onAttributeFocus: (id: string) => void;
} }
interface AttributeRowProps extends AttributeRowHandlers { interface AttributeRowProps extends AttributeRowHandlers {
attribute: AttributeInput; attribute: AttributeInput;
attributeValues: AttributeValueFragment[];
disabled: boolean; disabled: boolean;
error: ProductErrorWithAttributesFragment | PageErrorWithAttributesFragment; error: ProductErrorWithAttributesFragment | PageErrorWithAttributesFragment;
loading: boolean; loading: boolean;
@ -64,6 +70,7 @@ interface AttributeRowProps extends AttributeRowHandlers {
const AttributeRow: React.FC<AttributeRowProps> = ({ const AttributeRow: React.FC<AttributeRowProps> = ({
attribute, attribute,
attributeValues,
disabled, disabled,
error, error,
loading, loading,
@ -72,7 +79,10 @@ const AttributeRow: React.FC<AttributeRowProps> = ({
onReferencesAddClick, onReferencesAddClick,
onReferencesRemove, onReferencesRemove,
onReferencesReorder, onReferencesReorder,
onChange onChange,
fetchAttributeValues,
fetchMoreAttributeValues,
onAttributeFocus
}) => { }) => {
const intl = useIntl(); const intl = useIntl();
const classes = useStyles({}); const classes = useStyles({});
@ -126,15 +136,9 @@ const AttributeRow: React.FC<AttributeRowProps> = ({
return ( return (
<BasicAttributeRow label={attribute.label}> <BasicAttributeRow label={attribute.label}>
<SingleAutocompleteSelectField <SingleAutocompleteSelectField
choices={getSingleChoices(attribute.data.values)} choices={getSingleChoices(attributeValues)}
disabled={disabled} disabled={disabled}
displayValue={ displayValue={getSingleDisplayValue(attribute, attributeValues)}
attribute.data.values.find(
value => value.slug === attribute.value[0]
)?.name ||
attribute.value[0] ||
""
}
emptyOption={!attribute.data.isRequired} emptyOption={!attribute.data.isRequired}
error={!!error} error={!!error}
helperText={getErrorMessage(error, intl)} helperText={getErrorMessage(error, intl)}
@ -142,7 +146,10 @@ const AttributeRow: React.FC<AttributeRowProps> = ({
label={intl.formatMessage(messages.valueLabel)} label={intl.formatMessage(messages.valueLabel)}
value={attribute.value[0]} value={attribute.value[0]}
onChange={event => onChange(attribute.id, event.target.value)} onChange={event => onChange(attribute.id, event.target.value)}
allowCustomValues={!attribute.data.isRequired} allowCustomValues={true}
fetchChoices={fetchAttributeValues}
{...fetchMoreAttributeValues}
onFocus={() => onAttributeFocus(attribute.id)}
/> />
</BasicAttributeRow> </BasicAttributeRow>
); );
@ -192,8 +199,8 @@ const AttributeRow: React.FC<AttributeRowProps> = ({
return ( return (
<BasicAttributeRow label={attribute.label}> <BasicAttributeRow label={attribute.label}>
<MultiAutocompleteSelectField <MultiAutocompleteSelectField
choices={getMultiChoices(attribute.data.values)} choices={getMultiChoices(attributeValues)}
displayValues={getMultiDisplayValue(attribute)} displayValues={getMultiDisplayValue(attribute, attributeValues)}
disabled={disabled} disabled={disabled}
error={!!error} error={!!error}
helperText={getErrorMessage(error, intl)} helperText={getErrorMessage(error, intl)}
@ -201,7 +208,10 @@ const AttributeRow: React.FC<AttributeRowProps> = ({
name={`attribute:${attribute.label}`} name={`attribute:${attribute.label}`}
value={attribute.value} value={attribute.value}
onChange={event => onMultiChange(attribute.id, event.target.value)} onChange={event => onMultiChange(attribute.id, event.target.value)}
allowCustomValues={!attribute.data.isRequired} allowCustomValues={true}
fetchChoices={fetchAttributeValues}
{...fetchMoreAttributeValues}
onFocus={() => onAttributeFocus(attribute.id)}
/> />
</BasicAttributeRow> </BasicAttributeRow>
); );

View file

@ -1,4 +1,5 @@
import Attributes, { AttributesProps } from "@saleor/components/Attributes"; import Attributes, { AttributesProps } from "@saleor/components/Attributes";
import { fetchMoreProps } from "@saleor/fixtures";
import { storiesOf } from "@storybook/react"; import { storiesOf } from "@storybook/react";
import React from "react"; import React from "react";
@ -7,6 +8,7 @@ import { ATTRIBUTES, ATTRIBUTES_SELECTED } from "./fixtures";
const props: AttributesProps = { const props: AttributesProps = {
attributes: ATTRIBUTES, attributes: ATTRIBUTES,
attributeValues: [],
disabled: false, disabled: false,
errors: [], errors: [],
loading: false, loading: false,
@ -15,7 +17,10 @@ const props: AttributesProps = {
onMultiChange: () => undefined, onMultiChange: () => undefined,
onReferencesAddClick: () => undefined, onReferencesAddClick: () => undefined,
onReferencesRemove: () => undefined, onReferencesRemove: () => undefined,
onReferencesReorder: () => undefined onReferencesReorder: () => undefined,
onAttributeFocus: () => undefined,
fetchAttributeValues: () => undefined,
fetchMoreAttributeValues: fetchMoreProps
}; };
storiesOf("Attributes / Attributes", module) storiesOf("Attributes / Attributes", module)

View file

@ -8,6 +8,7 @@ import { PageErrorWithAttributesFragment } from "@saleor/fragments/types/PageErr
import { ProductErrorWithAttributesFragment } from "@saleor/fragments/types/ProductErrorWithAttributesFragment"; import { ProductErrorWithAttributesFragment } from "@saleor/fragments/types/ProductErrorWithAttributesFragment";
import { FormsetAtomicData } from "@saleor/hooks/useFormset"; import { FormsetAtomicData } from "@saleor/hooks/useFormset";
import { makeStyles } from "@saleor/theme"; import { makeStyles } from "@saleor/theme";
import { FetchMoreProps } from "@saleor/types";
import { import {
AttributeEntityTypeEnum, AttributeEntityTypeEnum,
AttributeInputTypeEnum, AttributeInputTypeEnum,
@ -34,12 +35,16 @@ export type AttributeInput = FormsetAtomicData<AttributeInputData, string[]>;
export type AttributeFileInput = FormsetAtomicData<AttributeInputData, File[]>; export type AttributeFileInput = FormsetAtomicData<AttributeInputData, File[]>;
export interface AttributesProps extends AttributeRowHandlers { export interface AttributesProps extends AttributeRowHandlers {
attributes: AttributeInput[]; attributes: AttributeInput[];
attributeValues: AttributeValueFragment[];
fetchAttributeValues: (query: string) => void;
fetchMoreAttributeValues: FetchMoreProps;
disabled: boolean; disabled: boolean;
loading: boolean; loading: boolean;
errors: Array< errors: Array<
ProductErrorWithAttributesFragment | PageErrorWithAttributesFragment ProductErrorWithAttributesFragment | PageErrorWithAttributesFragment
>; >;
title?: React.ReactNode; title?: React.ReactNode;
onAttributeFocus: (id: string) => void;
} }
const useStyles = makeStyles( const useStyles = makeStyles(
@ -109,6 +114,7 @@ const messages = defineMessages({
const Attributes: React.FC<AttributesProps> = ({ const Attributes: React.FC<AttributesProps> = ({
attributes, attributes,
attributeValues,
errors, errors,
title, title,
...props ...props
@ -158,6 +164,7 @@ const Attributes: React.FC<AttributesProps> = ({
{attributeIndex > 0 && <Hr />} {attributeIndex > 0 && <Hr />}
<AttributeRow <AttributeRow
attribute={attribute} attribute={attribute}
attributeValues={attributeValues}
error={error} error={error}
{...props} {...props}
/> />

View file

@ -89,15 +89,33 @@ export function getMultiChoices(
})); }));
} }
export function getSingleDisplayValue(
attribute: AttributeInput,
attributeValues: AttributeValueFragment[]
): string {
return (
attributeValues.find(value => value.slug === attribute.value[0])?.name ||
attribute.data.values.find(value => value.slug === attribute.value[0])
?.name ||
attribute.value[0] ||
""
);
}
export function getMultiDisplayValue( export function getMultiDisplayValue(
attribute: AttributeInput attribute: AttributeInput,
attributeValues: AttributeValueFragment[]
): MultiAutocompleteChoiceType[] { ): MultiAutocompleteChoiceType[] {
if (!attribute.value) { if (!attribute.value) {
return []; return [];
} }
return attribute.value.map(attributeValue => { return attribute.value.map(attributeValue => {
const definedAttributeValue = attribute.data.values.find( const definedAttributeValue =
attributeValues.find(
definedValue => definedValue.slug === attributeValue
) ||
attribute.data.values.find(
definedValue => definedValue.slug === attributeValue definedValue => definedValue.slug === attributeValue
); );
if (!!definedAttributeValue) { if (!!definedAttributeValue) {

View file

@ -85,6 +85,7 @@ export interface MultiAutocompleteSelectFieldProps
testId?: string; testId?: string;
fetchChoices?: (value: string) => void; fetchChoices?: (value: string) => void;
onChange: (event: React.ChangeEvent<any>) => void; onChange: (event: React.ChangeEvent<any>) => void;
onFocus?: () => void;
} }
const DebounceAutocomplete: React.ComponentType<DebounceProps< const DebounceAutocomplete: React.ComponentType<DebounceProps<
@ -109,6 +110,7 @@ const MultiAutocompleteSelectFieldComponent: React.FC<MultiAutocompleteSelectFie
testId, testId,
fetchChoices, fetchChoices,
onChange, onChange,
onFocus,
onFetchMore, onFetchMore,
...rest ...rest
} = props; } = props;
@ -163,7 +165,12 @@ const MultiAutocompleteSelectFieldComponent: React.FC<MultiAutocompleteSelectFie
</div> </div>
), ),
id: undefined, id: undefined,
onClick: toggleMenu onClick: toggleMenu,
onFocus: () => {
if (onFocus) {
onFocus();
}
}
}} }}
error={error} error={error}
helperText={helperText} helperText={helperText}

View file

@ -46,6 +46,7 @@ export interface SingleAutocompleteSelectFieldProps
InputProps?: InputProps; InputProps?: InputProps;
fetchChoices?: (value: string) => void; fetchChoices?: (value: string) => void;
onChange: (event: React.ChangeEvent<any>) => void; onChange: (event: React.ChangeEvent<any>) => void;
onFocus?: () => void;
FormHelperTextProps?: ExtendedFormHelperTextProps; FormHelperTextProps?: ExtendedFormHelperTextProps;
nakedInput?: boolean; nakedInput?: boolean;
} }
@ -75,6 +76,7 @@ const SingleAutocompleteSelectFieldComponent: React.FC<SingleAutocompleteSelectF
fetchChoices, fetchChoices,
onChange, onChange,
onFetchMore, onFetchMore,
onFocus,
FormHelperTextProps, FormHelperTextProps,
nakedInput = false, nakedInput = false,
...rest ...rest
@ -166,7 +168,12 @@ const SingleAutocompleteSelectFieldComponent: React.FC<SingleAutocompleteSelectF
error, error,
id: undefined, id: undefined,
onBlur: handleBlur, onBlur: handleBlur,
onClick: toggleMenu onClick: toggleMenu,
onFocus: () => {
if (onFocus) {
onFocus();
}
}
}; };
const nakedInputProps = nakedInput const nakedInputProps = nakedInput

View file

@ -151,7 +151,8 @@ const SingleAutocompleteSelectFieldContent: React.FC<SingleAutocompleteSelectFie
const anchor = React.useRef<HTMLDivElement>(); const anchor = React.useRef<HTMLDivElement>();
const scrollPosition = useElementScroll(anchor); const scrollPosition = useElementScroll(anchor);
const [calledForMore, setCalledForMore] = React.useState(false); const [calledForMore, setCalledForMore] = React.useState(false);
const [slice, setSlice] = React.useState(sliceSize); const [slice, setSlice] = React.useState(onFetchMore ? 10000 : sliceSize);
const [initialized, setInitialized] = React.useState(false);
const scrolledToBottom = isScrolledToBottom(anchor, scrollPosition, offset); const scrolledToBottom = isScrolledToBottom(anchor, scrollPosition, offset);
@ -159,20 +160,27 @@ const SingleAutocompleteSelectFieldContent: React.FC<SingleAutocompleteSelectFie
if (!calledForMore && onFetchMore && scrolledToBottom) { if (!calledForMore && onFetchMore && scrolledToBottom) {
onFetchMore(); onFetchMore();
setCalledForMore(true); setCalledForMore(true);
} else if (scrolledToBottom) { } else if (scrolledToBottom && !onFetchMore) {
setSlice(slice => slice + sliceSize); setSlice(slice => slice + sliceSize);
} }
}, [scrolledToBottom]); }, [scrolledToBottom]);
React.useEffect(() => { React.useEffect(() => {
if (!onFetchMore) {
setSlice(sliceSize); setSlice(sliceSize);
if (anchor.current?.scrollTo) { }
if (anchor.current?.scrollTo && !initialized) {
anchor.current.scrollTo({ anchor.current.scrollTo({
top: 0 top: 0
}); });
setInitialized(true);
} }
}, [choices?.length]); }, [choices?.length]);
React.useEffect(() => {
setInitialized(false);
}, [inputValue]);
React.useEffect(() => { React.useEffect(() => {
if (calledForMore && !loading) { if (calledForMore && !loading) {
setCalledForMore(false); setCalledForMore(false);
@ -183,6 +191,8 @@ const SingleAutocompleteSelectFieldContent: React.FC<SingleAutocompleteSelectFie
item: "" item: ""
}); });
const choicesToDisplay = choices.slice(0, slice);
return ( return (
<Paper className={classes.root}> <Paper className={classes.root}>
<div <div
@ -244,7 +254,7 @@ const SingleAutocompleteSelectFieldContent: React.FC<SingleAutocompleteSelectFie
{choices.length > 0 && (!!add || displayCustomValue) && ( {choices.length > 0 && (!!add || displayCustomValue) && (
<Hr className={classes.hr} /> <Hr className={classes.hr} />
)} )}
{choices.slice(0, slice).map((suggestion, index) => { {choicesToDisplay.map((suggestion, index) => {
const choiceIndex = getChoiceIndex( const choiceIndex = getChoiceIndex(
index, index,
emptyOption, emptyOption,

View file

@ -19,10 +19,12 @@ export const DEFAULT_INITIAL_PAGINATION_DATA: Pagination = {
}; };
export const PAGINATE_BY = 20; export const PAGINATE_BY = 20;
export const VALUES_PAGINATE_BY = 10;
export type ProductListColumns = "productType" | "availability" | "price"; export type ProductListColumns = "productType" | "availability" | "price";
export interface AppListViewSettings { export interface AppListViewSettings {
[ListViews.APPS_LIST]: ListSettings; [ListViews.APPS_LIST]: ListSettings;
[ListViews.ATTRIBUTE_VALUE_LIST]: ListSettings;
[ListViews.CATEGORY_LIST]: ListSettings; [ListViews.CATEGORY_LIST]: ListSettings;
[ListViews.COLLECTION_LIST]: ListSettings; [ListViews.COLLECTION_LIST]: ListSettings;
[ListViews.CUSTOMER_LIST]: ListSettings; [ListViews.CUSTOMER_LIST]: ListSettings;
@ -44,6 +46,9 @@ export const defaultListSettings: AppListViewSettings = {
[ListViews.APPS_LIST]: { [ListViews.APPS_LIST]: {
rowNumber: 10 rowNumber: 10
}, },
[ListViews.ATTRIBUTE_VALUE_LIST]: {
rowNumber: 10
},
[ListViews.CATEGORY_LIST]: { [ListViews.CATEGORY_LIST]: {
rowNumber: PAGINATE_BY rowNumber: PAGINATE_BY
}, },

View file

@ -2,6 +2,7 @@ import gql from "graphql-tag";
import { fileFragment } from "./file"; import { fileFragment } from "./file";
import { metadataFragment } from "./metadata"; import { metadataFragment } from "./metadata";
import { pageInfoFragment } from "./pageInfo";
export const attributeValueFragment = gql` export const attributeValueFragment = gql`
${fileFragment} ${fileFragment}
@ -33,7 +34,6 @@ export const attributeFragment = gql`
export const attributeDetailsFragment = gql` export const attributeDetailsFragment = gql`
${attributeFragment} ${attributeFragment}
${metadataFragment} ${metadataFragment}
${attributeValueFragment}
fragment AttributeDetailsFragment on Attribute { fragment AttributeDetailsFragment on Attribute {
...AttributeFragment ...AttributeFragment
...MetadataFragment ...MetadataFragment
@ -43,10 +43,23 @@ export const attributeDetailsFragment = gql`
unit unit
storefrontSearchPosition storefrontSearchPosition
valueRequired valueRequired
values { }
`;
export const attributeValueListFragment = gql`
${attributeValueFragment}
${pageInfoFragment}
fragment AttributeValueListFragment on AttributeValueCountableConnection {
pageInfo {
...PageInfoFragment
}
edges {
cursor
node {
...AttributeValueFragment ...AttributeValueFragment
} }
} }
}
`; `;
export const availableAttributeFragment = gql` export const availableAttributeFragment = gql`

View file

@ -1,6 +1,9 @@
import gql from "graphql-tag"; import gql from "graphql-tag";
import { attributeValueFragment } from "./attributes"; import {
attributeValueFragment,
attributeValueListFragment
} from "./attributes";
import { metadataFragment } from "./metadata"; import { metadataFragment } from "./metadata";
export const pageFragment = gql` export const pageFragment = gql`
@ -14,6 +17,7 @@ export const pageFragment = gql`
export const pageAttributesFragment = gql` export const pageAttributesFragment = gql`
${attributeValueFragment} ${attributeValueFragment}
${attributeValueListFragment}
fragment PageAttributesFragment on Page { fragment PageAttributesFragment on Page {
attributes { attributes {
attribute { attribute {
@ -24,8 +28,13 @@ export const pageAttributesFragment = gql`
entityType entityType
valueRequired valueRequired
unit unit
values { choices(
...AttributeValueFragment first: $firstValues
after: $afterValues
last: $lastValues
before: $beforeValues
) {
...AttributeValueListFragment
} }
} }
values { values {
@ -41,8 +50,13 @@ export const pageAttributesFragment = gql`
inputType inputType
entityType entityType
valueRequired valueRequired
values { choices(
...AttributeValueFragment first: $firstValues
after: $afterValues
last: $lastValues
before: $beforeValues
) {
...AttributeValueListFragment
} }
} }
} }

View file

@ -1,6 +1,9 @@
import gql from "graphql-tag"; import gql from "graphql-tag";
import { attributeValueFragment } from "./attributes"; import {
attributeValueFragment,
attributeValueListFragment
} from "./attributes";
import { metadataFragment } from "./metadata"; import { metadataFragment } from "./metadata";
import { taxTypeFragment } from "./taxes"; import { taxTypeFragment } from "./taxes";
import { weightFragment } from "./weight"; import { weightFragment } from "./weight";
@ -117,6 +120,7 @@ export const productFragment = gql`
export const productVariantAttributesFragment = gql` export const productVariantAttributesFragment = gql`
${priceRangeFragment} ${priceRangeFragment}
${attributeValueFragment} ${attributeValueFragment}
${attributeValueListFragment}
fragment ProductVariantAttributesFragment on Product { fragment ProductVariantAttributesFragment on Product {
id id
attributes { attributes {
@ -128,8 +132,13 @@ export const productVariantAttributesFragment = gql`
entityType entityType
valueRequired valueRequired
unit unit
values { choices(
...AttributeValueFragment first: $firstValues
after: $afterValues
last: $lastValues
before: $beforeValues
) {
...AttributeValueListFragment
} }
} }
values { values {
@ -141,8 +150,13 @@ export const productVariantAttributesFragment = gql`
variantAttributes(variantSelection: VARIANT_SELECTION) { variantAttributes(variantSelection: VARIANT_SELECTION) {
id id
name name
values { choices(
...AttributeValueFragment first: $firstValues
after: $afterValues
last: $lastValues
before: $beforeValues
) {
...AttributeValueListFragment
} }
} }
} }
@ -232,7 +246,7 @@ export const productFragmentDetails = gql`
`; `;
export const variantAttributeFragment = gql` export const variantAttributeFragment = gql`
${attributeValueFragment} ${attributeValueListFragment}
fragment VariantAttributeFragment on Attribute { fragment VariantAttributeFragment on Attribute {
id id
name name
@ -241,8 +255,13 @@ export const variantAttributeFragment = gql`
entityType entityType
valueRequired valueRequired
unit unit
values { choices(
...AttributeValueFragment first: $firstValues
after: $afterValues
last: $lastValues
before: $beforeValues
) {
...AttributeValueListFragment
} }
} }
`; `;

View file

@ -171,17 +171,17 @@ export const attributeTranslationFragment = gql`
id id
name name
inputType inputType
values { # values {
id # id
name # name
richText # richText
inputType # inputType
translation(languageCode: $language) { # translation(languageCode: $language) {
id # id
name # name
richText # richText
} # }
} # }
} }
} }
`; `;

View file

@ -21,22 +21,6 @@ export interface AttributeDetailsFragment_privateMetadata {
value: string; value: string;
} }
export interface AttributeDetailsFragment_values_file {
__typename: "File";
url: string;
contentType: string | null;
}
export interface AttributeDetailsFragment_values {
__typename: "AttributeValue";
id: string;
name: string | null;
slug: string | null;
file: AttributeDetailsFragment_values_file | null;
reference: string | null;
richText: any | null;
}
export interface AttributeDetailsFragment { export interface AttributeDetailsFragment {
__typename: "Attribute"; __typename: "Attribute";
id: string; id: string;
@ -54,5 +38,4 @@ export interface AttributeDetailsFragment {
entityType: AttributeEntityTypeEnum | null; entityType: AttributeEntityTypeEnum | null;
storefrontSearchPosition: number; storefrontSearchPosition: number;
valueRequired: boolean; valueRequired: boolean;
values: (AttributeDetailsFragment_values | null)[] | null;
} }

View file

@ -0,0 +1,44 @@
/* tslint:disable */
/* eslint-disable */
// @generated
// This file was automatically generated and should not be edited.
// ====================================================
// GraphQL fragment: AttributeValueListFragment
// ====================================================
export interface AttributeValueListFragment_pageInfo {
__typename: "PageInfo";
endCursor: string | null;
hasNextPage: boolean;
hasPreviousPage: boolean;
startCursor: string | null;
}
export interface AttributeValueListFragment_edges_node_file {
__typename: "File";
url: string;
contentType: string | null;
}
export interface AttributeValueListFragment_edges_node {
__typename: "AttributeValue";
id: string;
name: string | null;
slug: string | null;
file: AttributeValueListFragment_edges_node_file | null;
reference: string | null;
richText: any | null;
}
export interface AttributeValueListFragment_edges {
__typename: "AttributeValueCountableEdge";
cursor: string;
node: AttributeValueListFragment_edges_node;
}
export interface AttributeValueListFragment {
__typename: "AttributeValueCountableConnection";
pageInfo: AttributeValueListFragment_pageInfo;
edges: AttributeValueListFragment_edges[];
}

View file

@ -9,22 +9,42 @@ import { AttributeInputTypeEnum, AttributeEntityTypeEnum, MeasurementUnitsEnum }
// GraphQL fragment: PageAttributesFragment // GraphQL fragment: PageAttributesFragment
// ==================================================== // ====================================================
export interface PageAttributesFragment_attributes_attribute_values_file { export interface PageAttributesFragment_attributes_attribute_choices_pageInfo {
__typename: "PageInfo";
endCursor: string | null;
hasNextPage: boolean;
hasPreviousPage: boolean;
startCursor: string | null;
}
export interface PageAttributesFragment_attributes_attribute_choices_edges_node_file {
__typename: "File"; __typename: "File";
url: string; url: string;
contentType: string | null; contentType: string | null;
} }
export interface PageAttributesFragment_attributes_attribute_values { export interface PageAttributesFragment_attributes_attribute_choices_edges_node {
__typename: "AttributeValue"; __typename: "AttributeValue";
id: string; id: string;
name: string | null; name: string | null;
slug: string | null; slug: string | null;
file: PageAttributesFragment_attributes_attribute_values_file | null; file: PageAttributesFragment_attributes_attribute_choices_edges_node_file | null;
reference: string | null; reference: string | null;
richText: any | null; richText: any | null;
} }
export interface PageAttributesFragment_attributes_attribute_choices_edges {
__typename: "AttributeValueCountableEdge";
cursor: string;
node: PageAttributesFragment_attributes_attribute_choices_edges_node;
}
export interface PageAttributesFragment_attributes_attribute_choices {
__typename: "AttributeValueCountableConnection";
pageInfo: PageAttributesFragment_attributes_attribute_choices_pageInfo;
edges: PageAttributesFragment_attributes_attribute_choices_edges[];
}
export interface PageAttributesFragment_attributes_attribute { export interface PageAttributesFragment_attributes_attribute {
__typename: "Attribute"; __typename: "Attribute";
id: string; id: string;
@ -34,7 +54,7 @@ export interface PageAttributesFragment_attributes_attribute {
entityType: AttributeEntityTypeEnum | null; entityType: AttributeEntityTypeEnum | null;
valueRequired: boolean; valueRequired: boolean;
unit: MeasurementUnitsEnum | null; unit: MeasurementUnitsEnum | null;
values: (PageAttributesFragment_attributes_attribute_values | null)[] | null; choices: PageAttributesFragment_attributes_attribute_choices | null;
} }
export interface PageAttributesFragment_attributes_values_file { export interface PageAttributesFragment_attributes_values_file {
@ -59,22 +79,42 @@ export interface PageAttributesFragment_attributes {
values: (PageAttributesFragment_attributes_values | null)[]; values: (PageAttributesFragment_attributes_values | null)[];
} }
export interface PageAttributesFragment_pageType_attributes_values_file { export interface PageAttributesFragment_pageType_attributes_choices_pageInfo {
__typename: "PageInfo";
endCursor: string | null;
hasNextPage: boolean;
hasPreviousPage: boolean;
startCursor: string | null;
}
export interface PageAttributesFragment_pageType_attributes_choices_edges_node_file {
__typename: "File"; __typename: "File";
url: string; url: string;
contentType: string | null; contentType: string | null;
} }
export interface PageAttributesFragment_pageType_attributes_values { export interface PageAttributesFragment_pageType_attributes_choices_edges_node {
__typename: "AttributeValue"; __typename: "AttributeValue";
id: string; id: string;
name: string | null; name: string | null;
slug: string | null; slug: string | null;
file: PageAttributesFragment_pageType_attributes_values_file | null; file: PageAttributesFragment_pageType_attributes_choices_edges_node_file | null;
reference: string | null; reference: string | null;
richText: any | null; richText: any | null;
} }
export interface PageAttributesFragment_pageType_attributes_choices_edges {
__typename: "AttributeValueCountableEdge";
cursor: string;
node: PageAttributesFragment_pageType_attributes_choices_edges_node;
}
export interface PageAttributesFragment_pageType_attributes_choices {
__typename: "AttributeValueCountableConnection";
pageInfo: PageAttributesFragment_pageType_attributes_choices_pageInfo;
edges: PageAttributesFragment_pageType_attributes_choices_edges[];
}
export interface PageAttributesFragment_pageType_attributes { export interface PageAttributesFragment_pageType_attributes {
__typename: "Attribute"; __typename: "Attribute";
id: string; id: string;
@ -82,7 +122,7 @@ export interface PageAttributesFragment_pageType_attributes {
inputType: AttributeInputTypeEnum | null; inputType: AttributeInputTypeEnum | null;
entityType: AttributeEntityTypeEnum | null; entityType: AttributeEntityTypeEnum | null;
valueRequired: boolean; valueRequired: boolean;
values: (PageAttributesFragment_pageType_attributes_values | null)[] | null; choices: PageAttributesFragment_pageType_attributes_choices | null;
} }
export interface PageAttributesFragment_pageType { export interface PageAttributesFragment_pageType {

View file

@ -9,22 +9,42 @@ import { AttributeInputTypeEnum, AttributeEntityTypeEnum, MeasurementUnitsEnum }
// GraphQL fragment: PageDetailsFragment // GraphQL fragment: PageDetailsFragment
// ==================================================== // ====================================================
export interface PageDetailsFragment_attributes_attribute_values_file { export interface PageDetailsFragment_attributes_attribute_choices_pageInfo {
__typename: "PageInfo";
endCursor: string | null;
hasNextPage: boolean;
hasPreviousPage: boolean;
startCursor: string | null;
}
export interface PageDetailsFragment_attributes_attribute_choices_edges_node_file {
__typename: "File"; __typename: "File";
url: string; url: string;
contentType: string | null; contentType: string | null;
} }
export interface PageDetailsFragment_attributes_attribute_values { export interface PageDetailsFragment_attributes_attribute_choices_edges_node {
__typename: "AttributeValue"; __typename: "AttributeValue";
id: string; id: string;
name: string | null; name: string | null;
slug: string | null; slug: string | null;
file: PageDetailsFragment_attributes_attribute_values_file | null; file: PageDetailsFragment_attributes_attribute_choices_edges_node_file | null;
reference: string | null; reference: string | null;
richText: any | null; richText: any | null;
} }
export interface PageDetailsFragment_attributes_attribute_choices_edges {
__typename: "AttributeValueCountableEdge";
cursor: string;
node: PageDetailsFragment_attributes_attribute_choices_edges_node;
}
export interface PageDetailsFragment_attributes_attribute_choices {
__typename: "AttributeValueCountableConnection";
pageInfo: PageDetailsFragment_attributes_attribute_choices_pageInfo;
edges: PageDetailsFragment_attributes_attribute_choices_edges[];
}
export interface PageDetailsFragment_attributes_attribute { export interface PageDetailsFragment_attributes_attribute {
__typename: "Attribute"; __typename: "Attribute";
id: string; id: string;
@ -34,7 +54,7 @@ export interface PageDetailsFragment_attributes_attribute {
entityType: AttributeEntityTypeEnum | null; entityType: AttributeEntityTypeEnum | null;
valueRequired: boolean; valueRequired: boolean;
unit: MeasurementUnitsEnum | null; unit: MeasurementUnitsEnum | null;
values: (PageDetailsFragment_attributes_attribute_values | null)[] | null; choices: PageDetailsFragment_attributes_attribute_choices | null;
} }
export interface PageDetailsFragment_attributes_values_file { export interface PageDetailsFragment_attributes_values_file {
@ -59,22 +79,42 @@ export interface PageDetailsFragment_attributes {
values: (PageDetailsFragment_attributes_values | null)[]; values: (PageDetailsFragment_attributes_values | null)[];
} }
export interface PageDetailsFragment_pageType_attributes_values_file { export interface PageDetailsFragment_pageType_attributes_choices_pageInfo {
__typename: "PageInfo";
endCursor: string | null;
hasNextPage: boolean;
hasPreviousPage: boolean;
startCursor: string | null;
}
export interface PageDetailsFragment_pageType_attributes_choices_edges_node_file {
__typename: "File"; __typename: "File";
url: string; url: string;
contentType: string | null; contentType: string | null;
} }
export interface PageDetailsFragment_pageType_attributes_values { export interface PageDetailsFragment_pageType_attributes_choices_edges_node {
__typename: "AttributeValue"; __typename: "AttributeValue";
id: string; id: string;
name: string | null; name: string | null;
slug: string | null; slug: string | null;
file: PageDetailsFragment_pageType_attributes_values_file | null; file: PageDetailsFragment_pageType_attributes_choices_edges_node_file | null;
reference: string | null; reference: string | null;
richText: any | null; richText: any | null;
} }
export interface PageDetailsFragment_pageType_attributes_choices_edges {
__typename: "AttributeValueCountableEdge";
cursor: string;
node: PageDetailsFragment_pageType_attributes_choices_edges_node;
}
export interface PageDetailsFragment_pageType_attributes_choices {
__typename: "AttributeValueCountableConnection";
pageInfo: PageDetailsFragment_pageType_attributes_choices_pageInfo;
edges: PageDetailsFragment_pageType_attributes_choices_edges[];
}
export interface PageDetailsFragment_pageType_attributes { export interface PageDetailsFragment_pageType_attributes {
__typename: "Attribute"; __typename: "Attribute";
id: string; id: string;
@ -82,7 +122,7 @@ export interface PageDetailsFragment_pageType_attributes {
inputType: AttributeInputTypeEnum | null; inputType: AttributeInputTypeEnum | null;
entityType: AttributeEntityTypeEnum | null; entityType: AttributeEntityTypeEnum | null;
valueRequired: boolean; valueRequired: boolean;
values: (PageDetailsFragment_pageType_attributes_values | null)[] | null; choices: PageDetailsFragment_pageType_attributes_choices | null;
} }
export interface PageDetailsFragment_pageType { export interface PageDetailsFragment_pageType {

View file

@ -9,22 +9,42 @@ import { AttributeInputTypeEnum, AttributeEntityTypeEnum, MeasurementUnitsEnum,
// GraphQL fragment: Product // GraphQL fragment: Product
// ==================================================== // ====================================================
export interface Product_attributes_attribute_values_file { export interface Product_attributes_attribute_choices_pageInfo {
__typename: "PageInfo";
endCursor: string | null;
hasNextPage: boolean;
hasPreviousPage: boolean;
startCursor: string | null;
}
export interface Product_attributes_attribute_choices_edges_node_file {
__typename: "File"; __typename: "File";
url: string; url: string;
contentType: string | null; contentType: string | null;
} }
export interface Product_attributes_attribute_values { export interface Product_attributes_attribute_choices_edges_node {
__typename: "AttributeValue"; __typename: "AttributeValue";
id: string; id: string;
name: string | null; name: string | null;
slug: string | null; slug: string | null;
file: Product_attributes_attribute_values_file | null; file: Product_attributes_attribute_choices_edges_node_file | null;
reference: string | null; reference: string | null;
richText: any | null; richText: any | null;
} }
export interface Product_attributes_attribute_choices_edges {
__typename: "AttributeValueCountableEdge";
cursor: string;
node: Product_attributes_attribute_choices_edges_node;
}
export interface Product_attributes_attribute_choices {
__typename: "AttributeValueCountableConnection";
pageInfo: Product_attributes_attribute_choices_pageInfo;
edges: Product_attributes_attribute_choices_edges[];
}
export interface Product_attributes_attribute { export interface Product_attributes_attribute {
__typename: "Attribute"; __typename: "Attribute";
id: string; id: string;
@ -34,7 +54,7 @@ export interface Product_attributes_attribute {
entityType: AttributeEntityTypeEnum | null; entityType: AttributeEntityTypeEnum | null;
valueRequired: boolean; valueRequired: boolean;
unit: MeasurementUnitsEnum | null; unit: MeasurementUnitsEnum | null;
values: (Product_attributes_attribute_values | null)[] | null; choices: Product_attributes_attribute_choices | null;
} }
export interface Product_attributes_values_file { export interface Product_attributes_values_file {
@ -59,27 +79,47 @@ export interface Product_attributes {
values: (Product_attributes_values | null)[]; values: (Product_attributes_values | null)[];
} }
export interface Product_productType_variantAttributes_values_file { export interface Product_productType_variantAttributes_choices_pageInfo {
__typename: "PageInfo";
endCursor: string | null;
hasNextPage: boolean;
hasPreviousPage: boolean;
startCursor: string | null;
}
export interface Product_productType_variantAttributes_choices_edges_node_file {
__typename: "File"; __typename: "File";
url: string; url: string;
contentType: string | null; contentType: string | null;
} }
export interface Product_productType_variantAttributes_values { export interface Product_productType_variantAttributes_choices_edges_node {
__typename: "AttributeValue"; __typename: "AttributeValue";
id: string; id: string;
name: string | null; name: string | null;
slug: string | null; slug: string | null;
file: Product_productType_variantAttributes_values_file | null; file: Product_productType_variantAttributes_choices_edges_node_file | null;
reference: string | null; reference: string | null;
richText: any | null; richText: any | null;
} }
export interface Product_productType_variantAttributes_choices_edges {
__typename: "AttributeValueCountableEdge";
cursor: string;
node: Product_productType_variantAttributes_choices_edges_node;
}
export interface Product_productType_variantAttributes_choices {
__typename: "AttributeValueCountableConnection";
pageInfo: Product_productType_variantAttributes_choices_pageInfo;
edges: Product_productType_variantAttributes_choices_edges[];
}
export interface Product_productType_variantAttributes { export interface Product_productType_variantAttributes {
__typename: "Attribute"; __typename: "Attribute";
id: string; id: string;
name: string | null; name: string | null;
values: (Product_productType_variantAttributes_values | null)[] | null; choices: Product_productType_variantAttributes_choices | null;
} }
export interface Product_productType_taxType { export interface Product_productType_taxType {

View file

@ -21,22 +21,42 @@ export interface ProductVariant_privateMetadata {
value: string; value: string;
} }
export interface ProductVariant_selectionAttributes_attribute_values_file { export interface ProductVariant_selectionAttributes_attribute_choices_pageInfo {
__typename: "PageInfo";
endCursor: string | null;
hasNextPage: boolean;
hasPreviousPage: boolean;
startCursor: string | null;
}
export interface ProductVariant_selectionAttributes_attribute_choices_edges_node_file {
__typename: "File"; __typename: "File";
url: string; url: string;
contentType: string | null; contentType: string | null;
} }
export interface ProductVariant_selectionAttributes_attribute_values { export interface ProductVariant_selectionAttributes_attribute_choices_edges_node {
__typename: "AttributeValue"; __typename: "AttributeValue";
id: string; id: string;
name: string | null; name: string | null;
slug: string | null; slug: string | null;
file: ProductVariant_selectionAttributes_attribute_values_file | null; file: ProductVariant_selectionAttributes_attribute_choices_edges_node_file | null;
reference: string | null; reference: string | null;
richText: any | null; richText: any | null;
} }
export interface ProductVariant_selectionAttributes_attribute_choices_edges {
__typename: "AttributeValueCountableEdge";
cursor: string;
node: ProductVariant_selectionAttributes_attribute_choices_edges_node;
}
export interface ProductVariant_selectionAttributes_attribute_choices {
__typename: "AttributeValueCountableConnection";
pageInfo: ProductVariant_selectionAttributes_attribute_choices_pageInfo;
edges: ProductVariant_selectionAttributes_attribute_choices_edges[];
}
export interface ProductVariant_selectionAttributes_attribute { export interface ProductVariant_selectionAttributes_attribute {
__typename: "Attribute"; __typename: "Attribute";
id: string; id: string;
@ -46,7 +66,7 @@ export interface ProductVariant_selectionAttributes_attribute {
entityType: AttributeEntityTypeEnum | null; entityType: AttributeEntityTypeEnum | null;
valueRequired: boolean; valueRequired: boolean;
unit: MeasurementUnitsEnum | null; unit: MeasurementUnitsEnum | null;
values: (ProductVariant_selectionAttributes_attribute_values | null)[] | null; choices: ProductVariant_selectionAttributes_attribute_choices | null;
} }
export interface ProductVariant_selectionAttributes_values_file { export interface ProductVariant_selectionAttributes_values_file {
@ -71,22 +91,42 @@ export interface ProductVariant_selectionAttributes {
values: (ProductVariant_selectionAttributes_values | null)[]; values: (ProductVariant_selectionAttributes_values | null)[];
} }
export interface ProductVariant_nonSelectionAttributes_attribute_values_file { export interface ProductVariant_nonSelectionAttributes_attribute_choices_pageInfo {
__typename: "PageInfo";
endCursor: string | null;
hasNextPage: boolean;
hasPreviousPage: boolean;
startCursor: string | null;
}
export interface ProductVariant_nonSelectionAttributes_attribute_choices_edges_node_file {
__typename: "File"; __typename: "File";
url: string; url: string;
contentType: string | null; contentType: string | null;
} }
export interface ProductVariant_nonSelectionAttributes_attribute_values { export interface ProductVariant_nonSelectionAttributes_attribute_choices_edges_node {
__typename: "AttributeValue"; __typename: "AttributeValue";
id: string; id: string;
name: string | null; name: string | null;
slug: string | null; slug: string | null;
file: ProductVariant_nonSelectionAttributes_attribute_values_file | null; file: ProductVariant_nonSelectionAttributes_attribute_choices_edges_node_file | null;
reference: string | null; reference: string | null;
richText: any | null; richText: any | null;
} }
export interface ProductVariant_nonSelectionAttributes_attribute_choices_edges {
__typename: "AttributeValueCountableEdge";
cursor: string;
node: ProductVariant_nonSelectionAttributes_attribute_choices_edges_node;
}
export interface ProductVariant_nonSelectionAttributes_attribute_choices {
__typename: "AttributeValueCountableConnection";
pageInfo: ProductVariant_nonSelectionAttributes_attribute_choices_pageInfo;
edges: ProductVariant_nonSelectionAttributes_attribute_choices_edges[];
}
export interface ProductVariant_nonSelectionAttributes_attribute { export interface ProductVariant_nonSelectionAttributes_attribute {
__typename: "Attribute"; __typename: "Attribute";
id: string; id: string;
@ -96,7 +136,7 @@ export interface ProductVariant_nonSelectionAttributes_attribute {
entityType: AttributeEntityTypeEnum | null; entityType: AttributeEntityTypeEnum | null;
valueRequired: boolean; valueRequired: boolean;
unit: MeasurementUnitsEnum | null; unit: MeasurementUnitsEnum | null;
values: (ProductVariant_nonSelectionAttributes_attribute_values | null)[] | null; choices: ProductVariant_nonSelectionAttributes_attribute_choices | null;
} }
export interface ProductVariant_nonSelectionAttributes_values_file { export interface ProductVariant_nonSelectionAttributes_values_file {

View file

@ -9,22 +9,42 @@ import { AttributeInputTypeEnum, AttributeEntityTypeEnum, MeasurementUnitsEnum }
// GraphQL fragment: ProductVariantAttributesFragment // GraphQL fragment: ProductVariantAttributesFragment
// ==================================================== // ====================================================
export interface ProductVariantAttributesFragment_attributes_attribute_values_file { export interface ProductVariantAttributesFragment_attributes_attribute_choices_pageInfo {
__typename: "PageInfo";
endCursor: string | null;
hasNextPage: boolean;
hasPreviousPage: boolean;
startCursor: string | null;
}
export interface ProductVariantAttributesFragment_attributes_attribute_choices_edges_node_file {
__typename: "File"; __typename: "File";
url: string; url: string;
contentType: string | null; contentType: string | null;
} }
export interface ProductVariantAttributesFragment_attributes_attribute_values { export interface ProductVariantAttributesFragment_attributes_attribute_choices_edges_node {
__typename: "AttributeValue"; __typename: "AttributeValue";
id: string; id: string;
name: string | null; name: string | null;
slug: string | null; slug: string | null;
file: ProductVariantAttributesFragment_attributes_attribute_values_file | null; file: ProductVariantAttributesFragment_attributes_attribute_choices_edges_node_file | null;
reference: string | null; reference: string | null;
richText: any | null; richText: any | null;
} }
export interface ProductVariantAttributesFragment_attributes_attribute_choices_edges {
__typename: "AttributeValueCountableEdge";
cursor: string;
node: ProductVariantAttributesFragment_attributes_attribute_choices_edges_node;
}
export interface ProductVariantAttributesFragment_attributes_attribute_choices {
__typename: "AttributeValueCountableConnection";
pageInfo: ProductVariantAttributesFragment_attributes_attribute_choices_pageInfo;
edges: ProductVariantAttributesFragment_attributes_attribute_choices_edges[];
}
export interface ProductVariantAttributesFragment_attributes_attribute { export interface ProductVariantAttributesFragment_attributes_attribute {
__typename: "Attribute"; __typename: "Attribute";
id: string; id: string;
@ -34,7 +54,7 @@ export interface ProductVariantAttributesFragment_attributes_attribute {
entityType: AttributeEntityTypeEnum | null; entityType: AttributeEntityTypeEnum | null;
valueRequired: boolean; valueRequired: boolean;
unit: MeasurementUnitsEnum | null; unit: MeasurementUnitsEnum | null;
values: (ProductVariantAttributesFragment_attributes_attribute_values | null)[] | null; choices: ProductVariantAttributesFragment_attributes_attribute_choices | null;
} }
export interface ProductVariantAttributesFragment_attributes_values_file { export interface ProductVariantAttributesFragment_attributes_values_file {
@ -59,27 +79,47 @@ export interface ProductVariantAttributesFragment_attributes {
values: (ProductVariantAttributesFragment_attributes_values | null)[]; values: (ProductVariantAttributesFragment_attributes_values | null)[];
} }
export interface ProductVariantAttributesFragment_productType_variantAttributes_values_file { export interface ProductVariantAttributesFragment_productType_variantAttributes_choices_pageInfo {
__typename: "PageInfo";
endCursor: string | null;
hasNextPage: boolean;
hasPreviousPage: boolean;
startCursor: string | null;
}
export interface ProductVariantAttributesFragment_productType_variantAttributes_choices_edges_node_file {
__typename: "File"; __typename: "File";
url: string; url: string;
contentType: string | null; contentType: string | null;
} }
export interface ProductVariantAttributesFragment_productType_variantAttributes_values { export interface ProductVariantAttributesFragment_productType_variantAttributes_choices_edges_node {
__typename: "AttributeValue"; __typename: "AttributeValue";
id: string; id: string;
name: string | null; name: string | null;
slug: string | null; slug: string | null;
file: ProductVariantAttributesFragment_productType_variantAttributes_values_file | null; file: ProductVariantAttributesFragment_productType_variantAttributes_choices_edges_node_file | null;
reference: string | null; reference: string | null;
richText: any | null; richText: any | null;
} }
export interface ProductVariantAttributesFragment_productType_variantAttributes_choices_edges {
__typename: "AttributeValueCountableEdge";
cursor: string;
node: ProductVariantAttributesFragment_productType_variantAttributes_choices_edges_node;
}
export interface ProductVariantAttributesFragment_productType_variantAttributes_choices {
__typename: "AttributeValueCountableConnection";
pageInfo: ProductVariantAttributesFragment_productType_variantAttributes_choices_pageInfo;
edges: ProductVariantAttributesFragment_productType_variantAttributes_choices_edges[];
}
export interface ProductVariantAttributesFragment_productType_variantAttributes { export interface ProductVariantAttributesFragment_productType_variantAttributes {
__typename: "Attribute"; __typename: "Attribute";
id: string; id: string;
name: string | null; name: string | null;
values: (ProductVariantAttributesFragment_productType_variantAttributes_values | null)[] | null; choices: ProductVariantAttributesFragment_productType_variantAttributes_choices | null;
} }
export interface ProductVariantAttributesFragment_productType { export interface ProductVariantAttributesFragment_productType {

View file

@ -9,22 +9,42 @@ import { AttributeInputTypeEnum, AttributeEntityTypeEnum, MeasurementUnitsEnum }
// GraphQL fragment: SelectedVariantAttributeFragment // GraphQL fragment: SelectedVariantAttributeFragment
// ==================================================== // ====================================================
export interface SelectedVariantAttributeFragment_attribute_values_file { export interface SelectedVariantAttributeFragment_attribute_choices_pageInfo {
__typename: "PageInfo";
endCursor: string | null;
hasNextPage: boolean;
hasPreviousPage: boolean;
startCursor: string | null;
}
export interface SelectedVariantAttributeFragment_attribute_choices_edges_node_file {
__typename: "File"; __typename: "File";
url: string; url: string;
contentType: string | null; contentType: string | null;
} }
export interface SelectedVariantAttributeFragment_attribute_values { export interface SelectedVariantAttributeFragment_attribute_choices_edges_node {
__typename: "AttributeValue"; __typename: "AttributeValue";
id: string; id: string;
name: string | null; name: string | null;
slug: string | null; slug: string | null;
file: SelectedVariantAttributeFragment_attribute_values_file | null; file: SelectedVariantAttributeFragment_attribute_choices_edges_node_file | null;
reference: string | null; reference: string | null;
richText: any | null; richText: any | null;
} }
export interface SelectedVariantAttributeFragment_attribute_choices_edges {
__typename: "AttributeValueCountableEdge";
cursor: string;
node: SelectedVariantAttributeFragment_attribute_choices_edges_node;
}
export interface SelectedVariantAttributeFragment_attribute_choices {
__typename: "AttributeValueCountableConnection";
pageInfo: SelectedVariantAttributeFragment_attribute_choices_pageInfo;
edges: SelectedVariantAttributeFragment_attribute_choices_edges[];
}
export interface SelectedVariantAttributeFragment_attribute { export interface SelectedVariantAttributeFragment_attribute {
__typename: "Attribute"; __typename: "Attribute";
id: string; id: string;
@ -34,7 +54,7 @@ export interface SelectedVariantAttributeFragment_attribute {
entityType: AttributeEntityTypeEnum | null; entityType: AttributeEntityTypeEnum | null;
valueRequired: boolean; valueRequired: boolean;
unit: MeasurementUnitsEnum | null; unit: MeasurementUnitsEnum | null;
values: (SelectedVariantAttributeFragment_attribute_values | null)[] | null; choices: SelectedVariantAttributeFragment_attribute_choices | null;
} }
export interface SelectedVariantAttributeFragment_values_file { export interface SelectedVariantAttributeFragment_values_file {

View file

@ -9,22 +9,42 @@ import { AttributeInputTypeEnum, AttributeEntityTypeEnum, MeasurementUnitsEnum }
// GraphQL fragment: VariantAttributeFragment // GraphQL fragment: VariantAttributeFragment
// ==================================================== // ====================================================
export interface VariantAttributeFragment_values_file { export interface VariantAttributeFragment_choices_pageInfo {
__typename: "PageInfo";
endCursor: string | null;
hasNextPage: boolean;
hasPreviousPage: boolean;
startCursor: string | null;
}
export interface VariantAttributeFragment_choices_edges_node_file {
__typename: "File"; __typename: "File";
url: string; url: string;
contentType: string | null; contentType: string | null;
} }
export interface VariantAttributeFragment_values { export interface VariantAttributeFragment_choices_edges_node {
__typename: "AttributeValue"; __typename: "AttributeValue";
id: string; id: string;
name: string | null; name: string | null;
slug: string | null; slug: string | null;
file: VariantAttributeFragment_values_file | null; file: VariantAttributeFragment_choices_edges_node_file | null;
reference: string | null; reference: string | null;
richText: any | null; richText: any | null;
} }
export interface VariantAttributeFragment_choices_edges {
__typename: "AttributeValueCountableEdge";
cursor: string;
node: VariantAttributeFragment_choices_edges_node;
}
export interface VariantAttributeFragment_choices {
__typename: "AttributeValueCountableConnection";
pageInfo: VariantAttributeFragment_choices_pageInfo;
edges: VariantAttributeFragment_choices_edges[];
}
export interface VariantAttributeFragment { export interface VariantAttributeFragment {
__typename: "Attribute"; __typename: "Attribute";
id: string; id: string;
@ -34,5 +54,5 @@ export interface VariantAttributeFragment {
entityType: AttributeEntityTypeEnum | null; entityType: AttributeEntityTypeEnum | null;
valueRequired: boolean; valueRequired: boolean;
unit: MeasurementUnitsEnum | null; unit: MeasurementUnitsEnum | null;
values: (VariantAttributeFragment_values | null)[] | null; choices: VariantAttributeFragment_choices | null;
} }

View file

@ -0,0 +1,51 @@
import { useEffect, useState } from "react";
export interface PageInfo {
endCursor: number;
hasNextPage: boolean;
hasPreviousPage: boolean;
startCursor: number;
}
export function getMaxPage(valuesCount: number, paginateBy: number) {
return Math.floor(Math.max(0, valuesCount - 1) / paginateBy);
}
function useLocalPageInfo<T>(values: T[], paginateBy: number) {
const [page, setPage] = useState(0);
const maxPage = getMaxPage(values.length, paginateBy);
useEffect(() => {
if (page > maxPage) {
setPage(maxPage);
}
}, [values.length, paginateBy]);
const hasPreviousPage = page > 0;
const hasNextPage = page < maxPage;
const startCursor = page * paginateBy;
const endCursor = hasNextPage
? startCursor + paginateBy - 1
: Math.max(0, values.length - 1);
const pageValues = values.slice(startCursor, endCursor + 1);
const loadPreviousPage = () => setPage(page - 1);
const loadNextPage = () => setPage(page + 1);
return {
pageInfo: {
hasNextPage,
hasPreviousPage,
endCursor,
startCursor
},
pageValues,
loadNextPage,
loadPreviousPage,
loadPage: setPage
};
}
export default useLocalPageInfo;

View file

@ -0,0 +1,83 @@
import { useEffect, useState } from "react";
export interface PageInfo {
endCursor: string;
hasNextPage: boolean;
hasPreviousPage: boolean;
startCursor: string;
}
export interface PaginationState {
after?: string;
before?: string;
first?: number;
last?: number;
}
export function useLocalPaginationState(
paginateBy: number
): [PaginationState, (paginationState: PaginationState) => void] {
const [state, setState] = useState<PaginationState>({
first: paginateBy
});
const setPaginationState = (paginationState: PaginationState) => {
if (paginationState.after) {
setState({
after: paginationState.after,
first: paginateBy
});
} else if (paginationState.before) {
setState({
before: paginationState.before,
last: paginateBy
});
} else {
setState({
first: paginateBy
});
}
};
useEffect(() => {
setPaginationState(state);
}, [paginateBy]);
return [state, setPaginationState];
}
function useLocalPaginator(
setPaginationState: (paginationState: PaginationState) => void
) {
function paginate(pageInfo: PageInfo, paginationState: PaginationState) {
const loadNextPage = () =>
setPaginationState({
...paginationState,
after: pageInfo.endCursor,
before: undefined
});
const loadPreviousPage = () =>
setPaginationState({
...paginationState,
after: undefined,
before: pageInfo.startCursor
});
const newPageInfo = pageInfo
? {
...pageInfo,
hasNextPage: !!paginationState.before || pageInfo.hasNextPage,
hasPreviousPage: !!paginationState.after || pageInfo.hasPreviousPage
}
: undefined;
return {
loadNextPage,
loadPreviousPage,
pageInfo: newPageInfo
};
}
return paginate;
}
export default useLocalPaginator;

View file

@ -18,10 +18,13 @@ import { PageErrorWithAttributesFragment } from "@saleor/fragments/types/PageErr
import useDateLocalize from "@saleor/hooks/useDateLocalize"; import useDateLocalize from "@saleor/hooks/useDateLocalize";
import { SubmitPromise } from "@saleor/hooks/useForm"; import { SubmitPromise } from "@saleor/hooks/useForm";
import { sectionNames } from "@saleor/intl"; import { sectionNames } from "@saleor/intl";
import { PageType_pageType } from "@saleor/pages/types/PageType";
import { SearchAttributeValues_attribute_choices_edges_node } from "@saleor/searches/types/SearchAttributeValues";
import { SearchPages_search_edges_node } from "@saleor/searches/types/SearchPages"; import { SearchPages_search_edges_node } from "@saleor/searches/types/SearchPages";
import { SearchPageTypes_search_edges_node } from "@saleor/searches/types/SearchPageTypes"; import { SearchPageTypes_search_edges_node } from "@saleor/searches/types/SearchPageTypes";
import { SearchProducts_search_edges_node } from "@saleor/searches/types/SearchProducts"; import { SearchProducts_search_edges_node } from "@saleor/searches/types/SearchProducts";
import { FetchMoreProps } from "@saleor/types"; import { FetchMoreProps } from "@saleor/types";
import { mapNodeToChoice } from "@saleor/utils/maps";
import React from "react"; import React from "react";
import { useIntl } from "react-intl"; import { useIntl } from "react-intl";
@ -39,6 +42,8 @@ export interface PageDetailsPageProps {
referenceProducts?: SearchProducts_search_edges_node[]; referenceProducts?: SearchProducts_search_edges_node[];
allowEmptySlug?: boolean; allowEmptySlug?: boolean;
saveButtonBarState: ConfirmButtonTransitionState; saveButtonBarState: ConfirmButtonTransitionState;
selectedPageType?: PageType_pageType;
attributeValues: SearchAttributeValues_attribute_choices_edges_node[];
onBack: () => void; onBack: () => void;
onRemove: () => void; onRemove: () => void;
onSubmit: (data: PageData) => SubmitPromise; onSubmit: (data: PageData) => SubmitPromise;
@ -50,17 +55,23 @@ export interface PageDetailsPageProps {
fetchMoreReferencePages?: FetchMoreProps; fetchMoreReferencePages?: FetchMoreProps;
fetchReferenceProducts?: (data: string) => void; fetchReferenceProducts?: (data: string) => void;
fetchMoreReferenceProducts?: FetchMoreProps; fetchMoreReferenceProducts?: FetchMoreProps;
fetchAttributeValues: (query: string) => void;
fetchMoreAttributeValues?: FetchMoreProps;
onCloseDialog: () => void; onCloseDialog: () => void;
onSelectPageType?: (pageTypeId: string) => void;
onAttributeFocus: (id: string) => void;
} }
const PageDetailsPage: React.FC<PageDetailsPageProps> = ({ const PageDetailsPage: React.FC<PageDetailsPageProps> = ({
loading, loading,
errors, errors,
page, page,
pageTypes, pageTypes: pageTypeChoiceList,
referencePages = [], referencePages = [],
referenceProducts = [], referenceProducts = [],
saveButtonBarState, saveButtonBarState,
selectedPageType,
attributeValues,
onBack, onBack,
onRemove, onRemove,
onSubmit, onSubmit,
@ -72,7 +83,11 @@ const PageDetailsPage: React.FC<PageDetailsPageProps> = ({
fetchMoreReferencePages, fetchMoreReferencePages,
fetchReferenceProducts, fetchReferenceProducts,
fetchMoreReferenceProducts, fetchMoreReferenceProducts,
onCloseDialog fetchAttributeValues,
fetchMoreAttributeValues,
onCloseDialog,
onSelectPageType,
onAttributeFocus
}) => { }) => {
const intl = useIntl(); const intl = useIntl();
const localizeDate = useDateLocalize(); const localizeDate = useDateLocalize();
@ -81,6 +96,10 @@ const PageDetailsPage: React.FC<PageDetailsPageProps> = ({
const canOpenAssignReferencesAttributeDialog = !!assignReferencesAttributeId; const canOpenAssignReferencesAttributeDialog = !!assignReferencesAttributeId;
const pageTypes = pageTypeChoiceList
? mapNodeToChoice(pageTypeChoiceList)
: [];
const handleAssignReferenceAttribute = ( const handleAssignReferenceAttribute = (
attributeValues: string[], attributeValues: string[],
data: PageData, data: PageData,
@ -97,10 +116,15 @@ const PageDetailsPage: React.FC<PageDetailsPageProps> = ({
onCloseDialog(); onCloseDialog();
}; };
const handleSelectPageType = (pageTypeId: string) =>
onSelectPageType && onSelectPageType(pageTypeId);
return ( return (
<PageForm <PageForm
page={page} page={page}
pageTypes={pageTypes} pageTypes={pageTypeChoiceList}
selectedPageType={selectedPageType}
onSelectPageType={handleSelectPageType}
referencePages={referencePages} referencePages={referencePages}
referenceProducts={referenceProducts} referenceProducts={referenceProducts}
fetchReferencePages={fetchReferencePages} fetchReferencePages={fetchReferencePages}
@ -110,7 +134,7 @@ const PageDetailsPage: React.FC<PageDetailsPageProps> = ({
assignReferencesAttributeId={assignReferencesAttributeId} assignReferencesAttributeId={assignReferencesAttributeId}
onSubmit={onSubmit} onSubmit={onSubmit}
> >
{({ change, data, pageType, handlers, hasChanged, submit }) => ( {({ change, data, handlers, hasChanged, submit }) => (
<Container> <Container>
<AppHeader onBack={onBack}> <AppHeader onBack={onBack}>
{intl.formatMessage(sectionNames.pages)} {intl.formatMessage(sectionNames.pages)}
@ -155,6 +179,7 @@ const PageDetailsPage: React.FC<PageDetailsPageProps> = ({
{data.attributes.length > 0 && ( {data.attributes.length > 0 && (
<Attributes <Attributes
attributes={data.attributes} attributes={data.attributes}
attributeValues={attributeValues}
disabled={loading} disabled={loading}
loading={loading} loading={loading}
errors={errors} errors={errors}
@ -164,6 +189,9 @@ const PageDetailsPage: React.FC<PageDetailsPageProps> = ({
onReferencesRemove={handlers.selectAttributeReference} onReferencesRemove={handlers.selectAttributeReference}
onReferencesAddClick={onAssignReferencesClick} onReferencesAddClick={onAssignReferencesClick}
onReferencesReorder={handlers.reorderAttributeValue} onReferencesReorder={handlers.reorderAttributeValue}
fetchAttributeValues={fetchAttributeValues}
fetchMoreAttributeValues={fetchMoreAttributeValues}
onAttributeFocus={onAttributeFocus}
/> />
)} )}
<CardSpacer /> <CardSpacer />
@ -202,8 +230,8 @@ const PageDetailsPage: React.FC<PageDetailsPageProps> = ({
errors={errors} errors={errors}
disabled={loading} disabled={loading}
pageTypes={pageTypes} pageTypes={pageTypes}
pageType={pageType} pageType={data.pageType}
pageTypeInputDisplayValue={pageType?.name || ""} pageTypeInputDisplayValue={data.pageType?.name || ""}
onPageTypeChange={handlers.selectPageType} onPageTypeChange={handlers.selectPageType}
fetchPageTypes={fetchPageTypes} fetchPageTypes={fetchPageTypes}
fetchMorePageTypes={fetchMorePageTypes} fetchMorePageTypes={fetchMorePageTypes}

View file

@ -12,20 +12,23 @@ import {
import { AttributeInput } from "@saleor/components/Attributes"; import { AttributeInput } from "@saleor/components/Attributes";
import { MetadataFormData } from "@saleor/components/Metadata"; import { MetadataFormData } from "@saleor/components/Metadata";
import { RichTextEditorChange } from "@saleor/components/RichTextEditor"; import { RichTextEditorChange } from "@saleor/components/RichTextEditor";
import { PageTypeFragment } from "@saleor/fragments/types/PageTypeFragment";
import useForm, { FormChange, SubmitPromise } from "@saleor/hooks/useForm"; import useForm, { FormChange, SubmitPromise } from "@saleor/hooks/useForm";
import useFormset, { import useFormset, {
FormsetChange, FormsetChange,
FormsetData FormsetData
} from "@saleor/hooks/useFormset"; } from "@saleor/hooks/useFormset";
import useStateFromProps from "@saleor/hooks/useStateFromProps";
import { import {
PageDetails_page, PageDetails_page,
PageDetails_page_pageType PageDetails_page_pageType
} from "@saleor/pages/types/PageDetails"; } from "@saleor/pages/types/PageDetails";
import { getAttributeInputFromPage } from "@saleor/pages/utils/data"; import { PageType_pageType } from "@saleor/pages/types/PageType";
import {
getAttributeInputFromPage,
getAttributeInputFromPageType
} from "@saleor/pages/utils/data";
import { createPageTypeSelectHandler } from "@saleor/pages/utils/handlers"; import { createPageTypeSelectHandler } from "@saleor/pages/utils/handlers";
import { SearchPages_search_edges_node } from "@saleor/searches/types/SearchPages"; import { SearchPages_search_edges_node } from "@saleor/searches/types/SearchPages";
import { SearchPageTypes_search_edges_node } from "@saleor/searches/types/SearchPageTypes";
import { SearchProducts_search_edges_node } from "@saleor/searches/types/SearchProducts"; import { SearchProducts_search_edges_node } from "@saleor/searches/types/SearchProducts";
import { FetchMoreProps, ReorderEvent } from "@saleor/types"; import { FetchMoreProps, ReorderEvent } from "@saleor/types";
import getPublicationData from "@saleor/utils/data/getPublicationData"; import getPublicationData from "@saleor/utils/data/getPublicationData";
@ -43,7 +46,7 @@ export interface PageFormData extends MetadataFormData {
seoTitle: string; seoTitle: string;
slug: string; slug: string;
title: string; title: string;
pageType: string; pageType: PageType_pageType | PageDetails_page_pageType;
} }
export interface PageData extends PageFormData { export interface PageData extends PageFormData {
attributes: AttributeInput[]; attributes: AttributeInput[];
@ -71,14 +74,13 @@ export interface PageUpdateHandlers {
export interface UsePageUpdateFormResult { export interface UsePageUpdateFormResult {
change: FormChange; change: FormChange;
data: PageData; data: PageData;
pageType: PageTypeFragment;
handlers: PageUpdateHandlers; handlers: PageUpdateHandlers;
hasChanged: boolean; hasChanged: boolean;
submit: () => void; submit: () => void;
} }
export interface UsePageFormOpts { export interface UsePageFormOpts {
pageTypes?: PageDetails_page_pageType[]; pageTypes?: SearchPageTypes_search_edges_node[];
referencePages: SearchPages_search_edges_node[]; referencePages: SearchPages_search_edges_node[];
referenceProducts: SearchProducts_search_edges_node[]; referenceProducts: SearchProducts_search_edges_node[];
fetchReferencePages?: (data: string) => void; fetchReferencePages?: (data: string) => void;
@ -86,12 +88,13 @@ export interface UsePageFormOpts {
fetchReferenceProducts?: (data: string) => void; fetchReferenceProducts?: (data: string) => void;
fetchMoreReferenceProducts?: FetchMoreProps; fetchMoreReferenceProducts?: FetchMoreProps;
assignReferencesAttributeId?: string; assignReferencesAttributeId?: string;
selectedPageType?: PageType_pageType;
onSelectPageType: (pageTypeId: string) => void;
} }
export interface PageFormProps extends UsePageFormOpts { export interface PageFormProps extends UsePageFormOpts {
children: (props: UsePageUpdateFormResult) => React.ReactNode; children: (props: UsePageUpdateFormResult) => React.ReactNode;
page: PageDetails_page; page: PageDetails_page;
pageTypes?: PageDetails_page_pageType[];
onSubmit: (data: PageData) => SubmitPromise; onSubmit: (data: PageData) => SubmitPromise;
} }
@ -105,13 +108,19 @@ function usePageForm(
const pageExists = page !== null; const pageExists = page !== null;
const attributes = useFormset(getAttributeInputFromPage(page)); const attributes = useFormset(
pageExists
? getAttributeInputFromPage(page)
: opts.selectedPageType
? getAttributeInputFromPageType(opts.selectedPageType)
: []
);
const attributesWithNewFileValue = useFormset<null, File>([]); const attributesWithNewFileValue = useFormset<null, File>([]);
const form = useForm<PageFormData>({ const form = useForm<PageFormData>({
isPublished: page?.isPublished, isPublished: page?.isPublished,
metadata: pageExists ? page?.metadata?.map(mapMetadataItemToInput) : [], metadata: pageExists ? page?.metadata?.map(mapMetadataItemToInput) : [],
pageType: page?.pageType.id || "", pageType: null,
privateMetadata: pageExists privateMetadata: pageExists
? page?.privateMetadata?.map(mapMetadataItemToInput) ? page?.privateMetadata?.map(mapMetadataItemToInput)
: [], : [],
@ -126,10 +135,6 @@ function usePageForm(
triggerChange triggerChange
}); });
const [pageType, setPageType] = useStateFromProps<PageTypeFragment>(
page?.pageType || null
);
const { const {
isMetadataModified, isMetadataModified,
isPrivateMetadataModified, isPrivateMetadataModified,
@ -141,11 +146,9 @@ function usePageForm(
triggerChange(); triggerChange();
}; };
const changeMetadata = makeMetadataChangeHandler(handleChange); const changeMetadata = makeMetadataChangeHandler(handleChange);
const selectPageType = createPageTypeSelectHandler( const handlePageTypeSelect = createPageTypeSelectHandler(
handleChange, opts.onSelectPageType,
attributes.set, triggerChange
setPageType,
opts.pageTypes
); );
const handleAttributeChange = createAttributeChangeHandler( const handleAttributeChange = createAttributeChangeHandler(
attributes.change, attributes.change,
@ -194,7 +197,8 @@ function usePageForm(
opts.referencePages, opts.referencePages,
opts.referenceProducts opts.referenceProducts
), ),
content: content.current content: content.current,
pageType: pageExists ? page?.pageType : opts.selectedPageType
}); });
const getSubmitData = (): PageSubmitData => ({ const getSubmitData = (): PageSubmitData => ({
@ -232,10 +236,9 @@ function usePageForm(
selectAttributeFile: handleAttributeFileChange, selectAttributeFile: handleAttributeFileChange,
selectAttributeMulti: handleAttributeMultiChange, selectAttributeMulti: handleAttributeMultiChange,
selectAttributeReference: handleAttributeReferenceChange, selectAttributeReference: handleAttributeReferenceChange,
selectPageType selectPageType: handlePageTypeSelect
}, },
hasChanged: changed, hasChanged: changed,
pageType,
submit submit
}; };
} }

View file

@ -1,6 +1,8 @@
import { Card, CardContent, Typography } from "@material-ui/core"; import { Card, CardContent, Typography } from "@material-ui/core";
import CardTitle from "@saleor/components/CardTitle"; import CardTitle from "@saleor/components/CardTitle";
import SingleAutocompleteSelectField from "@saleor/components/SingleAutocompleteSelectField"; import SingleAutocompleteSelectField, {
SingleAutocompleteChoiceType
} from "@saleor/components/SingleAutocompleteSelectField";
import { PageErrorFragment } from "@saleor/fragments/types/PageErrorFragment"; import { PageErrorFragment } from "@saleor/fragments/types/PageErrorFragment";
import { PageTypeFragment } from "@saleor/fragments/types/PageTypeFragment"; import { PageTypeFragment } from "@saleor/fragments/types/PageTypeFragment";
import { FormChange } from "@saleor/hooks/useForm"; import { FormChange } from "@saleor/hooks/useForm";
@ -8,7 +10,6 @@ import { makeStyles } from "@saleor/theme";
import { FetchMoreProps } from "@saleor/types"; import { FetchMoreProps } from "@saleor/types";
import { getFormErrors } from "@saleor/utils/errors"; import { getFormErrors } from "@saleor/utils/errors";
import getPageErrorMessage from "@saleor/utils/errors/page"; import getPageErrorMessage from "@saleor/utils/errors/page";
import { mapNodeToChoice } from "@saleor/utils/maps";
import React from "react"; import React from "react";
import { FormattedMessage, useIntl } from "react-intl"; import { FormattedMessage, useIntl } from "react-intl";
@ -21,7 +22,7 @@ export interface PageOrganizeContentProps {
pageTypeInputDisplayValue?: string; pageTypeInputDisplayValue?: string;
errors: PageErrorFragment[]; errors: PageErrorFragment[];
disabled: boolean; disabled: boolean;
pageTypes: PageTypeFragment[]; pageTypes: SingleAutocompleteChoiceType[];
onPageTypeChange?: FormChange; onPageTypeChange?: FormChange;
fetchPageTypes?: (data: string) => void; fetchPageTypes?: (data: string) => void;
fetchMorePageTypes?: FetchMoreProps; fetchMorePageTypes?: FetchMoreProps;
@ -76,8 +77,8 @@ const PageOrganizeContent: React.FC<PageOrganizeContentProps> = props => {
helperText={getPageErrorMessage(formErrors.pageType, intl)} helperText={getPageErrorMessage(formErrors.pageType, intl)}
name={"pageType" as keyof PageFormData} name={"pageType" as keyof PageFormData}
onChange={onPageTypeChange} onChange={onPageTypeChange}
value={data.pageType} value={data.pageType?.id}
choices={pageTypes ? mapNodeToChoice(pageTypes) : []} choices={pageTypes}
InputProps={{ InputProps={{
autoComplete: "off" autoComplete: "off"
}} }}

View file

@ -49,8 +49,20 @@ export const page: PageDetails_page = {
inputType: AttributeInputTypeEnum.DROPDOWN, inputType: AttributeInputTypeEnum.DROPDOWN,
valueRequired: false, valueRequired: false,
unit: null, unit: null,
values: [ choices: {
__typename: "AttributeValueCountableConnection",
pageInfo: {
__typename: "PageInfo",
endCursor: "",
hasNextPage: false,
hasPreviousPage: false,
startCursor: ""
},
edges: [
{ {
__typename: "AttributeValueCountableEdge",
cursor: "",
node: {
id: "QXR0cmlidXRlVmFsdWU6ODc=", id: "QXR0cmlidXRlVmFsdWU6ODc=",
name: "Suzanne Ellison", name: "Suzanne Ellison",
slug: "suzanne-ellison", slug: "suzanne-ellison",
@ -58,8 +70,12 @@ export const page: PageDetails_page = {
__typename: "AttributeValue", __typename: "AttributeValue",
file: null, file: null,
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge",
cursor: "",
node: {
id: "QXR0cmlidXRlVmFsdWU6ODg=", id: "QXR0cmlidXRlVmFsdWU6ODg=",
name: "Dennis Perkins", name: "Dennis Perkins",
slug: "dennis-perkins", slug: "dennis-perkins",
@ -67,8 +83,12 @@ export const page: PageDetails_page = {
__typename: "AttributeValue", __typename: "AttributeValue",
file: null, file: null,
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge",
cursor: "",
node: {
id: "QXR0cmlidXRlVmFsdWU6ODk=", id: "QXR0cmlidXRlVmFsdWU6ODk=",
name: "Dylan Lamb", name: "Dylan Lamb",
slug: "dylan-lamb", slug: "dylan-lamb",
@ -77,7 +97,9 @@ export const page: PageDetails_page = {
file: null, file: null,
richText: null richText: null
} }
], }
]
},
__typename: "Attribute" __typename: "Attribute"
}, },
values: [ values: [
@ -102,8 +124,20 @@ export const page: PageDetails_page = {
inputType: AttributeInputTypeEnum.MULTISELECT, inputType: AttributeInputTypeEnum.MULTISELECT,
valueRequired: false, valueRequired: false,
unit: null, unit: null,
values: [ choices: {
__typename: "AttributeValueCountableConnection",
pageInfo: {
__typename: "PageInfo",
endCursor: "",
hasNextPage: false,
hasPreviousPage: false,
startCursor: ""
},
edges: [
{ {
__typename: "AttributeValueCountableEdge",
cursor: "",
node: {
id: "QXR0cmlidXRlVmFsdWU6OTA=", id: "QXR0cmlidXRlVmFsdWU6OTA=",
name: "Security", name: "Security",
slug: "security", slug: "security",
@ -111,8 +145,12 @@ export const page: PageDetails_page = {
__typename: "AttributeValue", __typename: "AttributeValue",
file: null, file: null,
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge",
cursor: "",
node: {
id: "QXR0cmlidXRlVmFsdWU6OTE=", id: "QXR0cmlidXRlVmFsdWU6OTE=",
name: "Support", name: "Support",
slug: "support", slug: "support",
@ -120,8 +158,12 @@ export const page: PageDetails_page = {
__typename: "AttributeValue", __typename: "AttributeValue",
file: null, file: null,
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge",
cursor: "",
node: {
id: "QXR0cmlidXRlVmFsdWU6OTI=", id: "QXR0cmlidXRlVmFsdWU6OTI=",
name: "Medical", name: "Medical",
slug: "medical", slug: "medical",
@ -129,8 +171,12 @@ export const page: PageDetails_page = {
__typename: "AttributeValue", __typename: "AttributeValue",
file: null, file: null,
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge",
cursor: "",
node: {
id: "QXR0cmlidXRlVmFsdWU6OTM=", id: "QXR0cmlidXRlVmFsdWU6OTM=",
name: "General", name: "General",
slug: "general", slug: "general",
@ -139,7 +185,9 @@ export const page: PageDetails_page = {
file: null, file: null,
richText: null richText: null
} }
], }
]
},
__typename: "Attribute" __typename: "Attribute"
}, },
values: [ values: [
@ -177,8 +225,20 @@ export const page: PageDetails_page = {
entityType: null, entityType: null,
inputType: AttributeInputTypeEnum.DROPDOWN, inputType: AttributeInputTypeEnum.DROPDOWN,
valueRequired: false, valueRequired: false,
values: [ choices: {
__typename: "AttributeValueCountableConnection",
pageInfo: {
__typename: "PageInfo",
endCursor: "",
hasNextPage: false,
hasPreviousPage: false,
startCursor: ""
},
edges: [
{ {
__typename: "AttributeValueCountableEdge",
cursor: "",
node: {
id: "QXR0cmlidXRlVmFsdWU6ODc=", id: "QXR0cmlidXRlVmFsdWU6ODc=",
name: "Suzanne Ellison", name: "Suzanne Ellison",
slug: "suzanne-ellison", slug: "suzanne-ellison",
@ -186,8 +246,12 @@ export const page: PageDetails_page = {
__typename: "AttributeValue", __typename: "AttributeValue",
file: null, file: null,
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge",
cursor: "",
node: {
id: "QXR0cmlidXRlVmFsdWU6ODg=", id: "QXR0cmlidXRlVmFsdWU6ODg=",
name: "Dennis Perkins", name: "Dennis Perkins",
slug: "dennis-perkins", slug: "dennis-perkins",
@ -195,8 +259,12 @@ export const page: PageDetails_page = {
__typename: "AttributeValue", __typename: "AttributeValue",
file: null, file: null,
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge",
cursor: "",
node: {
id: "QXR0cmlidXRlVmFsdWU6ODk=", id: "QXR0cmlidXRlVmFsdWU6ODk=",
name: "Dylan Lamb", name: "Dylan Lamb",
slug: "dylan-lamb", slug: "dylan-lamb",
@ -205,7 +273,9 @@ export const page: PageDetails_page = {
file: null, file: null,
richText: null richText: null
} }
], }
]
},
__typename: "Attribute" __typename: "Attribute"
}, },
{ {
@ -214,8 +284,20 @@ export const page: PageDetails_page = {
entityType: null, entityType: null,
inputType: AttributeInputTypeEnum.MULTISELECT, inputType: AttributeInputTypeEnum.MULTISELECT,
valueRequired: false, valueRequired: false,
values: [ choices: {
__typename: "AttributeValueCountableConnection",
pageInfo: {
__typename: "PageInfo",
endCursor: "",
hasNextPage: false,
hasPreviousPage: false,
startCursor: ""
},
edges: [
{ {
__typename: "AttributeValueCountableEdge",
cursor: "",
node: {
id: "QXR0cmlidXRlVmFsdWU6OTA=", id: "QXR0cmlidXRlVmFsdWU6OTA=",
name: "Security", name: "Security",
slug: "security", slug: "security",
@ -223,8 +305,12 @@ export const page: PageDetails_page = {
__typename: "AttributeValue", __typename: "AttributeValue",
file: null, file: null,
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge",
cursor: "",
node: {
id: "QXR0cmlidXRlVmFsdWU6OTE=", id: "QXR0cmlidXRlVmFsdWU6OTE=",
name: "Support", name: "Support",
slug: "support", slug: "support",
@ -232,8 +318,12 @@ export const page: PageDetails_page = {
__typename: "AttributeValue", __typename: "AttributeValue",
file: null, file: null,
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge",
cursor: "",
node: {
id: "QXR0cmlidXRlVmFsdWU6OTI=", id: "QXR0cmlidXRlVmFsdWU6OTI=",
name: "Medical", name: "Medical",
slug: "medical", slug: "medical",
@ -241,8 +331,12 @@ export const page: PageDetails_page = {
__typename: "AttributeValue", __typename: "AttributeValue",
file: null, file: null,
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge",
cursor: "",
node: {
id: "QXR0cmlidXRlVmFsdWU6OTM=", id: "QXR0cmlidXRlVmFsdWU6OTM=",
name: "General", name: "General",
slug: "general", slug: "general",
@ -251,7 +345,9 @@ export const page: PageDetails_page = {
file: null, file: null,
richText: null richText: null
} }
], }
]
},
__typename: "Attribute" __typename: "Attribute"
} }
] ]

View file

@ -20,7 +20,6 @@ import { PageRemove, PageRemoveVariables } from "./types/PageRemove";
import { PageUpdate, PageUpdateVariables } from "./types/PageUpdate"; import { PageUpdate, PageUpdateVariables } from "./types/PageUpdate";
const pageCreate = gql` const pageCreate = gql`
${pageDetailsFragment}
${pageErrorWithAttributesFragment} ${pageErrorWithAttributesFragment}
mutation PageCreate($input: PageCreateInput!) { mutation PageCreate($input: PageCreateInput!) {
pageCreate(input: $input) { pageCreate(input: $input) {
@ -29,7 +28,7 @@ const pageCreate = gql`
message message
} }
page { page {
...PageDetailsFragment id
} }
} }
} }
@ -41,7 +40,14 @@ export const TypedPageCreate = TypedMutation<PageCreate, PageCreateVariables>(
const pageUpdate = gql` const pageUpdate = gql`
${pageDetailsFragment} ${pageDetailsFragment}
${pageErrorWithAttributesFragment} ${pageErrorWithAttributesFragment}
mutation PageUpdate($id: ID!, $input: PageInput!) { mutation PageUpdate(
$id: ID!
$input: PageInput!
$firstValues: Int
$afterValues: String
$lastValues: Int
$beforeValues: String
) {
pageUpdate(id: $id, input: $input) { pageUpdate(id: $id, input: $input) {
errors { errors {
...PageErrorWithAttributesFragment ...PageErrorWithAttributesFragment

View file

@ -1,3 +1,4 @@
import { attributeValueListFragment } from "@saleor/fragments/attributes";
import { pageDetailsFragment, pageFragment } from "@saleor/fragments/pages"; import { pageDetailsFragment, pageFragment } from "@saleor/fragments/pages";
import makeQuery from "@saleor/hooks/makeQuery"; import makeQuery from "@saleor/hooks/makeQuery";
import gql from "graphql-tag"; import gql from "graphql-tag";
@ -5,6 +6,7 @@ import gql from "graphql-tag";
import { PageCount, PageCountVariables } from "./types/PageCount"; import { PageCount, PageCountVariables } from "./types/PageCount";
import { PageDetails, PageDetailsVariables } from "./types/PageDetails"; import { PageDetails, PageDetailsVariables } from "./types/PageDetails";
import { PageList, PageListVariables } from "./types/PageList"; import { PageList, PageListVariables } from "./types/PageList";
import { PageType, PageTypeVariables } from "./types/PageType";
const pageList = gql` const pageList = gql`
${pageFragment} ${pageFragment}
@ -42,7 +44,13 @@ export const usePageListQuery = makeQuery<PageList, PageListVariables>(
const pageDetails = gql` const pageDetails = gql`
${pageDetailsFragment} ${pageDetailsFragment}
query PageDetails($id: ID!) { query PageDetails(
$id: ID!
$firstValues: Int
$afterValues: String
$lastValues: Int
$beforeValues: String
) {
page(id: $id) { page(id: $id) {
...PageDetailsFragment ...PageDetailsFragment
} }
@ -52,6 +60,41 @@ export const usePageDetailsQuery = makeQuery<PageDetails, PageDetailsVariables>(
pageDetails pageDetails
); );
const pageTypeQuery = gql`
${attributeValueListFragment}
query PageType(
$id: ID!
$firstValues: Int
$afterValues: String
$lastValues: Int
$beforeValues: String
) {
pageType(id: $id) {
id
name
attributes {
id
inputType
entityType
slug
name
valueRequired
choices(
first: $firstValues
after: $afterValues
last: $lastValues
before: $beforeValues
) {
...AttributeValueListFragment
}
}
}
}
`;
export const usePageTypeQuery = makeQuery<PageType, PageTypeVariables>(
pageTypeQuery
);
const pageCountQuery = gql` const pageCountQuery = gql`
query PageCount($filter: PageFilterInput) { query PageCount($filter: PageFilterInput) {
pages(filter: $filter) { pages(filter: $filter) {

View file

@ -3,7 +3,7 @@
// @generated // @generated
// This file was automatically generated and should not be edited. // This file was automatically generated and should not be edited.
import { PageCreateInput, PageErrorCode, AttributeInputTypeEnum, AttributeEntityTypeEnum, MeasurementUnitsEnum } from "./../../types/globalTypes"; import { PageCreateInput, PageErrorCode } from "./../../types/globalTypes";
// ==================================================== // ====================================================
// GraphQL mutation operation: PageCreate // GraphQL mutation operation: PageCreate
@ -17,115 +17,9 @@ export interface PageCreate_pageCreate_errors {
message: string | null; message: string | null;
} }
export interface PageCreate_pageCreate_page_attributes_attribute_values_file {
__typename: "File";
url: string;
contentType: string | null;
}
export interface PageCreate_pageCreate_page_attributes_attribute_values {
__typename: "AttributeValue";
id: string;
name: string | null;
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 {
__typename: "Attribute";
id: string;
slug: string | null;
name: string | null;
inputType: AttributeInputTypeEnum | null;
entityType: AttributeEntityTypeEnum | null;
valueRequired: boolean;
unit: MeasurementUnitsEnum | null;
values: (PageCreate_pageCreate_page_attributes_attribute_values | null)[] | null;
}
export interface PageCreate_pageCreate_page_attributes_values_file {
__typename: "File";
url: string;
contentType: string | null;
}
export interface PageCreate_pageCreate_page_attributes_values {
__typename: "AttributeValue";
id: string;
name: string | null;
slug: string | null;
file: PageCreate_pageCreate_page_attributes_values_file | null;
reference: string | null;
richText: any | null;
}
export interface PageCreate_pageCreate_page_attributes {
__typename: "SelectedAttribute";
attribute: PageCreate_pageCreate_page_attributes_attribute;
values: (PageCreate_pageCreate_page_attributes_values | null)[];
}
export interface PageCreate_pageCreate_page_pageType_attributes_values_file {
__typename: "File";
url: string;
contentType: string | null;
}
export interface PageCreate_pageCreate_page_pageType_attributes_values {
__typename: "AttributeValue";
id: string;
name: string | null;
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 {
__typename: "Attribute";
id: string;
name: string | null;
inputType: AttributeInputTypeEnum | null;
entityType: AttributeEntityTypeEnum | null;
valueRequired: boolean;
values: (PageCreate_pageCreate_page_pageType_attributes_values | null)[] | null;
}
export interface PageCreate_pageCreate_page_pageType {
__typename: "PageType";
id: string;
name: string;
attributes: (PageCreate_pageCreate_page_pageType_attributes | null)[] | null;
}
export interface PageCreate_pageCreate_page_metadata {
__typename: "MetadataItem";
key: string;
value: string;
}
export interface PageCreate_pageCreate_page_privateMetadata {
__typename: "MetadataItem";
key: string;
value: string;
}
export interface PageCreate_pageCreate_page { export interface PageCreate_pageCreate_page {
__typename: "Page"; __typename: "Page";
id: string; id: string;
title: string;
slug: string;
isPublished: boolean;
attributes: PageCreate_pageCreate_page_attributes[];
pageType: PageCreate_pageCreate_page_pageType;
metadata: (PageCreate_pageCreate_page_metadata | null)[];
privateMetadata: (PageCreate_pageCreate_page_privateMetadata | null)[];
content: any | null;
seoTitle: string | null;
seoDescription: string | null;
publicationDate: any | null;
} }
export interface PageCreate_pageCreate { export interface PageCreate_pageCreate {

View file

@ -9,22 +9,42 @@ import { AttributeInputTypeEnum, AttributeEntityTypeEnum, MeasurementUnitsEnum }
// GraphQL query operation: PageDetails // GraphQL query operation: PageDetails
// ==================================================== // ====================================================
export interface PageDetails_page_attributes_attribute_values_file { export interface PageDetails_page_attributes_attribute_choices_pageInfo {
__typename: "PageInfo";
endCursor: string | null;
hasNextPage: boolean;
hasPreviousPage: boolean;
startCursor: string | null;
}
export interface PageDetails_page_attributes_attribute_choices_edges_node_file {
__typename: "File"; __typename: "File";
url: string; url: string;
contentType: string | null; contentType: string | null;
} }
export interface PageDetails_page_attributes_attribute_values { export interface PageDetails_page_attributes_attribute_choices_edges_node {
__typename: "AttributeValue"; __typename: "AttributeValue";
id: string; id: string;
name: string | null; name: string | null;
slug: string | null; slug: string | null;
file: PageDetails_page_attributes_attribute_values_file | null; file: PageDetails_page_attributes_attribute_choices_edges_node_file | null;
reference: string | null; reference: string | null;
richText: any | null; richText: any | null;
} }
export interface PageDetails_page_attributes_attribute_choices_edges {
__typename: "AttributeValueCountableEdge";
cursor: string;
node: PageDetails_page_attributes_attribute_choices_edges_node;
}
export interface PageDetails_page_attributes_attribute_choices {
__typename: "AttributeValueCountableConnection";
pageInfo: PageDetails_page_attributes_attribute_choices_pageInfo;
edges: PageDetails_page_attributes_attribute_choices_edges[];
}
export interface PageDetails_page_attributes_attribute { export interface PageDetails_page_attributes_attribute {
__typename: "Attribute"; __typename: "Attribute";
id: string; id: string;
@ -34,7 +54,7 @@ export interface PageDetails_page_attributes_attribute {
entityType: AttributeEntityTypeEnum | null; entityType: AttributeEntityTypeEnum | null;
valueRequired: boolean; valueRequired: boolean;
unit: MeasurementUnitsEnum | null; unit: MeasurementUnitsEnum | null;
values: (PageDetails_page_attributes_attribute_values | null)[] | null; choices: PageDetails_page_attributes_attribute_choices | null;
} }
export interface PageDetails_page_attributes_values_file { export interface PageDetails_page_attributes_values_file {
@ -59,22 +79,42 @@ export interface PageDetails_page_attributes {
values: (PageDetails_page_attributes_values | null)[]; values: (PageDetails_page_attributes_values | null)[];
} }
export interface PageDetails_page_pageType_attributes_values_file { export interface PageDetails_page_pageType_attributes_choices_pageInfo {
__typename: "PageInfo";
endCursor: string | null;
hasNextPage: boolean;
hasPreviousPage: boolean;
startCursor: string | null;
}
export interface PageDetails_page_pageType_attributes_choices_edges_node_file {
__typename: "File"; __typename: "File";
url: string; url: string;
contentType: string | null; contentType: string | null;
} }
export interface PageDetails_page_pageType_attributes_values { export interface PageDetails_page_pageType_attributes_choices_edges_node {
__typename: "AttributeValue"; __typename: "AttributeValue";
id: string; id: string;
name: string | null; name: string | null;
slug: string | null; slug: string | null;
file: PageDetails_page_pageType_attributes_values_file | null; file: PageDetails_page_pageType_attributes_choices_edges_node_file | null;
reference: string | null; reference: string | null;
richText: any | null; richText: any | null;
} }
export interface PageDetails_page_pageType_attributes_choices_edges {
__typename: "AttributeValueCountableEdge";
cursor: string;
node: PageDetails_page_pageType_attributes_choices_edges_node;
}
export interface PageDetails_page_pageType_attributes_choices {
__typename: "AttributeValueCountableConnection";
pageInfo: PageDetails_page_pageType_attributes_choices_pageInfo;
edges: PageDetails_page_pageType_attributes_choices_edges[];
}
export interface PageDetails_page_pageType_attributes { export interface PageDetails_page_pageType_attributes {
__typename: "Attribute"; __typename: "Attribute";
id: string; id: string;
@ -82,7 +122,7 @@ export interface PageDetails_page_pageType_attributes {
inputType: AttributeInputTypeEnum | null; inputType: AttributeInputTypeEnum | null;
entityType: AttributeEntityTypeEnum | null; entityType: AttributeEntityTypeEnum | null;
valueRequired: boolean; valueRequired: boolean;
values: (PageDetails_page_pageType_attributes_values | null)[] | null; choices: PageDetails_page_pageType_attributes_choices | null;
} }
export interface PageDetails_page_pageType { export interface PageDetails_page_pageType {
@ -126,4 +166,8 @@ export interface PageDetails {
export interface PageDetailsVariables { export interface PageDetailsVariables {
id: string; id: string;
firstValues?: number | null;
afterValues?: string | null;
lastValues?: number | null;
beforeValues?: string | null;
} }

View file

@ -0,0 +1,76 @@
/* tslint:disable */
/* eslint-disable */
// @generated
// This file was automatically generated and should not be edited.
import { AttributeInputTypeEnum, AttributeEntityTypeEnum } from "./../../types/globalTypes";
// ====================================================
// GraphQL query operation: PageType
// ====================================================
export interface PageType_pageType_attributes_choices_pageInfo {
__typename: "PageInfo";
endCursor: string | null;
hasNextPage: boolean;
hasPreviousPage: boolean;
startCursor: string | null;
}
export interface PageType_pageType_attributes_choices_edges_node_file {
__typename: "File";
url: string;
contentType: string | null;
}
export interface PageType_pageType_attributes_choices_edges_node {
__typename: "AttributeValue";
id: string;
name: string | null;
slug: string | null;
file: PageType_pageType_attributes_choices_edges_node_file | null;
reference: string | null;
richText: any | null;
}
export interface PageType_pageType_attributes_choices_edges {
__typename: "AttributeValueCountableEdge";
cursor: string;
node: PageType_pageType_attributes_choices_edges_node;
}
export interface PageType_pageType_attributes_choices {
__typename: "AttributeValueCountableConnection";
pageInfo: PageType_pageType_attributes_choices_pageInfo;
edges: PageType_pageType_attributes_choices_edges[];
}
export interface PageType_pageType_attributes {
__typename: "Attribute";
id: string;
inputType: AttributeInputTypeEnum | null;
entityType: AttributeEntityTypeEnum | null;
slug: string | null;
name: string | null;
valueRequired: boolean;
choices: PageType_pageType_attributes_choices | null;
}
export interface PageType_pageType {
__typename: "PageType";
id: string;
name: string;
attributes: (PageType_pageType_attributes | null)[] | null;
}
export interface PageType {
pageType: PageType_pageType | null;
}
export interface PageTypeVariables {
id: string;
firstValues?: number | null;
afterValues?: string | null;
lastValues?: number | null;
beforeValues?: string | null;
}

View file

@ -16,22 +16,42 @@ export interface PageUpdate_pageUpdate_errors {
attributes: string[] | null; attributes: string[] | null;
} }
export interface PageUpdate_pageUpdate_page_attributes_attribute_values_file { export interface PageUpdate_pageUpdate_page_attributes_attribute_choices_pageInfo {
__typename: "PageInfo";
endCursor: string | null;
hasNextPage: boolean;
hasPreviousPage: boolean;
startCursor: string | null;
}
export interface PageUpdate_pageUpdate_page_attributes_attribute_choices_edges_node_file {
__typename: "File"; __typename: "File";
url: string; url: string;
contentType: string | null; contentType: string | null;
} }
export interface PageUpdate_pageUpdate_page_attributes_attribute_values { export interface PageUpdate_pageUpdate_page_attributes_attribute_choices_edges_node {
__typename: "AttributeValue"; __typename: "AttributeValue";
id: string; id: string;
name: string | null; name: string | null;
slug: string | null; slug: string | null;
file: PageUpdate_pageUpdate_page_attributes_attribute_values_file | null; file: PageUpdate_pageUpdate_page_attributes_attribute_choices_edges_node_file | null;
reference: string | null; reference: string | null;
richText: any | null; richText: any | null;
} }
export interface PageUpdate_pageUpdate_page_attributes_attribute_choices_edges {
__typename: "AttributeValueCountableEdge";
cursor: string;
node: PageUpdate_pageUpdate_page_attributes_attribute_choices_edges_node;
}
export interface PageUpdate_pageUpdate_page_attributes_attribute_choices {
__typename: "AttributeValueCountableConnection";
pageInfo: PageUpdate_pageUpdate_page_attributes_attribute_choices_pageInfo;
edges: PageUpdate_pageUpdate_page_attributes_attribute_choices_edges[];
}
export interface PageUpdate_pageUpdate_page_attributes_attribute { export interface PageUpdate_pageUpdate_page_attributes_attribute {
__typename: "Attribute"; __typename: "Attribute";
id: string; id: string;
@ -41,7 +61,7 @@ export interface PageUpdate_pageUpdate_page_attributes_attribute {
entityType: AttributeEntityTypeEnum | null; entityType: AttributeEntityTypeEnum | null;
valueRequired: boolean; valueRequired: boolean;
unit: MeasurementUnitsEnum | null; unit: MeasurementUnitsEnum | null;
values: (PageUpdate_pageUpdate_page_attributes_attribute_values | null)[] | null; choices: PageUpdate_pageUpdate_page_attributes_attribute_choices | null;
} }
export interface PageUpdate_pageUpdate_page_attributes_values_file { export interface PageUpdate_pageUpdate_page_attributes_values_file {
@ -66,22 +86,42 @@ export interface PageUpdate_pageUpdate_page_attributes {
values: (PageUpdate_pageUpdate_page_attributes_values | null)[]; values: (PageUpdate_pageUpdate_page_attributes_values | null)[];
} }
export interface PageUpdate_pageUpdate_page_pageType_attributes_values_file { export interface PageUpdate_pageUpdate_page_pageType_attributes_choices_pageInfo {
__typename: "PageInfo";
endCursor: string | null;
hasNextPage: boolean;
hasPreviousPage: boolean;
startCursor: string | null;
}
export interface PageUpdate_pageUpdate_page_pageType_attributes_choices_edges_node_file {
__typename: "File"; __typename: "File";
url: string; url: string;
contentType: string | null; contentType: string | null;
} }
export interface PageUpdate_pageUpdate_page_pageType_attributes_values { export interface PageUpdate_pageUpdate_page_pageType_attributes_choices_edges_node {
__typename: "AttributeValue"; __typename: "AttributeValue";
id: string; id: string;
name: string | null; name: string | null;
slug: string | null; slug: string | null;
file: PageUpdate_pageUpdate_page_pageType_attributes_values_file | null; file: PageUpdate_pageUpdate_page_pageType_attributes_choices_edges_node_file | null;
reference: string | null; reference: string | null;
richText: any | null; richText: any | null;
} }
export interface PageUpdate_pageUpdate_page_pageType_attributes_choices_edges {
__typename: "AttributeValueCountableEdge";
cursor: string;
node: PageUpdate_pageUpdate_page_pageType_attributes_choices_edges_node;
}
export interface PageUpdate_pageUpdate_page_pageType_attributes_choices {
__typename: "AttributeValueCountableConnection";
pageInfo: PageUpdate_pageUpdate_page_pageType_attributes_choices_pageInfo;
edges: PageUpdate_pageUpdate_page_pageType_attributes_choices_edges[];
}
export interface PageUpdate_pageUpdate_page_pageType_attributes { export interface PageUpdate_pageUpdate_page_pageType_attributes {
__typename: "Attribute"; __typename: "Attribute";
id: string; id: string;
@ -89,7 +129,7 @@ export interface PageUpdate_pageUpdate_page_pageType_attributes {
inputType: AttributeInputTypeEnum | null; inputType: AttributeInputTypeEnum | null;
entityType: AttributeEntityTypeEnum | null; entityType: AttributeEntityTypeEnum | null;
valueRequired: boolean; valueRequired: boolean;
values: (PageUpdate_pageUpdate_page_pageType_attributes_values | null)[] | null; choices: PageUpdate_pageUpdate_page_pageType_attributes_choices | null;
} }
export interface PageUpdate_pageUpdate_page_pageType { export interface PageUpdate_pageUpdate_page_pageType {
@ -140,4 +180,8 @@ export interface PageUpdate {
export interface PageUpdateVariables { export interface PageUpdateVariables {
id: string; id: string;
input: PageInput; input: PageInput;
firstValues?: number | null;
afterValues?: string | null;
lastValues?: number | null;
beforeValues?: string | null;
} }

View file

@ -1,5 +1,6 @@
import { getSelectedAttributeValues } from "@saleor/attributes/utils/data"; import { getSelectedAttributeValues } from "@saleor/attributes/utils/data";
import { AttributeInput } from "@saleor/components/Attributes"; import { AttributeInput } from "@saleor/components/Attributes";
import { mapEdgesToItems } from "@saleor/utils/maps";
import { import {
PageDetails_page, PageDetails_page,
@ -15,7 +16,7 @@ export function getAttributeInputFromPage(
inputType: attribute.attribute.inputType, inputType: attribute.attribute.inputType,
isRequired: attribute.attribute.valueRequired, isRequired: attribute.attribute.valueRequired,
selectedValues: attribute.values, selectedValues: attribute.values,
values: attribute.attribute.values, values: mapEdgesToItems(attribute.attribute.choices),
unit: attribute.attribute.unit unit: attribute.attribute.unit
}, },
id: attribute.attribute.id, id: attribute.attribute.id,
@ -32,7 +33,7 @@ export function getAttributeInputFromPageType(
entityType: attribute.entityType, entityType: attribute.entityType,
inputType: attribute.inputType, inputType: attribute.inputType,
isRequired: attribute.valueRequired, isRequired: attribute.valueRequired,
values: attribute.values values: mapEdgesToItems(attribute.choices)
}, },
id: attribute.id, id: attribute.id,
label: attribute.name, label: attribute.name,

View file

@ -1,24 +1,12 @@
import { AttributeInputData } from "@saleor/components/Attributes";
import { FormChange } from "@saleor/hooks/useForm"; import { FormChange } from "@saleor/hooks/useForm";
import { FormsetData } from "@saleor/hooks/useFormset";
import { PageDetails_page_pageType } from "../types/PageDetails";
import { getAttributeInputFromPageType } from "./data";
export function createPageTypeSelectHandler( export function createPageTypeSelectHandler(
change: FormChange, setPageType: (pageTypeId: string) => void,
setAttributes: (data: FormsetData<AttributeInputData>) => void, triggerChange: () => void
setPageType: (pageType: PageDetails_page_pageType) => void,
pageTypeChoiceList: PageDetails_page_pageType[]
): FormChange { ): FormChange {
return (event: React.ChangeEvent<any>) => { return (event: React.ChangeEvent<any>) => {
const id = event.target.value; const id = event.target.value;
const selectedPageType = pageTypeChoiceList.find( setPageType(id);
pageType => pageType.id === id triggerChange();
);
setPageType(selectedPageType);
change(event);
setAttributes(getAttributeInputFromPageType(selectedPageType));
}; };
} }

View file

@ -5,10 +5,14 @@ import {
} from "@saleor/attributes/utils/handlers"; } from "@saleor/attributes/utils/handlers";
import { AttributeInput } from "@saleor/components/Attributes"; import { AttributeInput } from "@saleor/components/Attributes";
import { WindowTitle } from "@saleor/components/WindowTitle"; import { WindowTitle } from "@saleor/components/WindowTitle";
import { DEFAULT_INITIAL_SEARCH_DATA } from "@saleor/config"; import {
DEFAULT_INITIAL_SEARCH_DATA,
VALUES_PAGINATE_BY
} from "@saleor/config";
import { useFileUploadMutation } from "@saleor/files/mutations"; import { useFileUploadMutation } from "@saleor/files/mutations";
import useNavigator from "@saleor/hooks/useNavigator"; import useNavigator from "@saleor/hooks/useNavigator";
import useNotifier from "@saleor/hooks/useNotifier"; import useNotifier from "@saleor/hooks/useNotifier";
import useAttributeValueSearch from "@saleor/searches/useAttributeValueSearch";
import usePageSearch from "@saleor/searches/usePageSearch"; import usePageSearch from "@saleor/searches/usePageSearch";
import usePageTypeSearch from "@saleor/searches/usePageTypeSearch"; import usePageTypeSearch from "@saleor/searches/usePageTypeSearch";
import useProductSearch from "@saleor/searches/useProductSearch"; import useProductSearch from "@saleor/searches/useProductSearch";
@ -19,12 +23,13 @@ import {
usePrivateMetadataUpdate usePrivateMetadataUpdate
} from "@saleor/utils/metadata/updateMetadata"; } from "@saleor/utils/metadata/updateMetadata";
import { getParsedDataForJsonStringField } from "@saleor/utils/richText/misc"; import { getParsedDataForJsonStringField } from "@saleor/utils/richText/misc";
import React from "react"; import React, { useState } from "react";
import { useIntl } from "react-intl"; import { useIntl } from "react-intl";
import PageDetailsPage from "../components/PageDetailsPage"; import PageDetailsPage from "../components/PageDetailsPage";
import { PageSubmitData } from "../components/PageDetailsPage/form"; import { PageSubmitData } from "../components/PageDetailsPage/form";
import { TypedPageCreate } from "../mutations"; import { TypedPageCreate } from "../mutations";
import { usePageTypeQuery } from "../queries";
import { PageCreate as PageCreateData } from "../types/PageCreate"; import { PageCreate as PageCreateData } from "../types/PageCreate";
import { import {
pageCreateUrl, pageCreateUrl,
@ -45,6 +50,8 @@ export const PageCreate: React.FC<PageCreateProps> = ({ params }) => {
const [updateMetadata] = useMetadataUpdate({}); const [updateMetadata] = useMetadataUpdate({});
const [updatePrivateMetadata] = usePrivateMetadataUpdate({}); const [updatePrivateMetadata] = usePrivateMetadataUpdate({});
const [selectedPageTypeId, setSelectedPageTypeId] = React.useState<string>();
const { const {
loadMore: loadMorePageTypes, loadMore: loadMorePageTypes,
search: searchPageTypes, search: searchPageTypes,
@ -52,7 +59,6 @@ export const PageCreate: React.FC<PageCreateProps> = ({ params }) => {
} = usePageTypeSearch({ } = usePageTypeSearch({
variables: DEFAULT_INITIAL_SEARCH_DATA variables: DEFAULT_INITIAL_SEARCH_DATA
}); });
const { const {
loadMore: loadMorePages, loadMore: loadMorePages,
search: searchPages, search: searchPages,
@ -60,7 +66,6 @@ export const PageCreate: React.FC<PageCreateProps> = ({ params }) => {
} = usePageSearch({ } = usePageSearch({
variables: DEFAULT_INITIAL_SEARCH_DATA variables: DEFAULT_INITIAL_SEARCH_DATA
}); });
const { const {
loadMore: loadMoreProducts, loadMore: loadMoreProducts,
search: searchProducts, search: searchProducts,
@ -68,6 +73,30 @@ export const PageCreate: React.FC<PageCreateProps> = ({ params }) => {
} = useProductSearch({ } = useProductSearch({
variables: DEFAULT_INITIAL_SEARCH_DATA variables: DEFAULT_INITIAL_SEARCH_DATA
}); });
const [focusedAttribute, setFocusedAttribute] = useState<string>();
const {
loadMore: loadMoreAttributeValues,
search: searchAttributeValues,
result: searchAttributeValuesOpts
} = useAttributeValueSearch({
variables: {
id: focusedAttribute,
...DEFAULT_INITIAL_SEARCH_DATA
},
skip: !focusedAttribute
});
const { data: selectedPageType } = usePageTypeQuery({
variables: {
id: selectedPageTypeId,
firstValues: VALUES_PAGINATE_BY
},
skip: !selectedPageTypeId
});
const attributeValues = mapEdgesToItems(
searchAttributeValuesOpts?.data?.attribute.choices
);
const [uploadFile, uploadFileOpts] = useFileUploadMutation({}); const [uploadFile, uploadFileOpts] = useFileUploadMutation({});
@ -96,18 +125,22 @@ export const PageCreate: React.FC<PageCreateProps> = ({ params }) => {
loading: searchPageTypesOpts.loading, loading: searchPageTypesOpts.loading,
onFetchMore: loadMorePageTypes onFetchMore: loadMorePageTypes
}; };
const fetchMoreReferencePages = { const fetchMoreReferencePages = {
hasMore: searchPagesOpts.data?.search?.pageInfo?.hasNextPage, hasMore: searchPagesOpts.data?.search?.pageInfo?.hasNextPage,
loading: searchPagesOpts.loading, loading: searchPagesOpts.loading,
onFetchMore: loadMorePages onFetchMore: loadMorePages
}; };
const fetchMoreReferenceProducts = { const fetchMoreReferenceProducts = {
hasMore: searchProductsOpts.data?.search?.pageInfo?.hasNextPage, hasMore: searchProductsOpts.data?.search?.pageInfo?.hasNextPage,
loading: searchProductsOpts.loading, loading: searchProductsOpts.loading,
onFetchMore: loadMoreProducts onFetchMore: loadMoreProducts
}; };
const fetchMoreAttributeValues = {
hasMore: !!searchAttributeValuesOpts.data?.attribute?.choices?.pageInfo
?.hasNextPage,
loading: !!searchAttributeValuesOpts.loading,
onFetchMore: loadMoreAttributeValues
};
return ( return (
<TypedPageCreate onCompleted={handlePageCreate}> <TypedPageCreate onCompleted={handlePageCreate}>
@ -132,7 +165,7 @@ export const PageCreate: React.FC<PageCreateProps> = ({ params }) => {
}), }),
content: getParsedDataForJsonStringField(formData.content), content: getParsedDataForJsonStringField(formData.content),
isPublished: formData.isPublished, isPublished: formData.isPublished,
pageType: formData.pageType, pageType: formData.pageType?.id,
publicationDate: formData.publicationDate, publicationDate: formData.publicationDate,
seo: { seo: {
description: formData.seoDescription, description: formData.seoDescription,
@ -165,6 +198,7 @@ export const PageCreate: React.FC<PageCreateProps> = ({ params }) => {
errors={pageCreateOpts.data?.pageCreate.errors || []} errors={pageCreateOpts.data?.pageCreate.errors || []}
saveButtonBarState={pageCreateOpts.status} saveButtonBarState={pageCreateOpts.status}
page={null} page={null}
attributeValues={attributeValues}
pageTypes={mapEdgesToItems(searchPageTypesOpts?.data?.search)} pageTypes={mapEdgesToItems(searchPageTypesOpts?.data?.search)}
onBack={() => navigate(pageListUrl())} onBack={() => navigate(pageListUrl())}
onRemove={() => undefined} onRemove={() => undefined}
@ -183,7 +217,12 @@ export const PageCreate: React.FC<PageCreateProps> = ({ params }) => {
fetchMoreReferencePages={fetchMoreReferencePages} fetchMoreReferencePages={fetchMoreReferencePages}
fetchReferenceProducts={searchProducts} fetchReferenceProducts={searchProducts}
fetchMoreReferenceProducts={fetchMoreReferenceProducts} fetchMoreReferenceProducts={fetchMoreReferenceProducts}
fetchAttributeValues={searchAttributeValues}
fetchMoreAttributeValues={fetchMoreAttributeValues}
onCloseDialog={() => navigate(pageCreateUrl())} onCloseDialog={() => navigate(pageCreateUrl())}
selectedPageType={selectedPageType?.pageType}
onSelectPageType={id => setSelectedPageTypeId(id)}
onAttributeFocus={setFocusedAttribute}
/> />
</> </>
); );

View file

@ -13,7 +13,10 @@ import {
import ActionDialog from "@saleor/components/ActionDialog"; import ActionDialog from "@saleor/components/ActionDialog";
import { AttributeInput } from "@saleor/components/Attributes"; import { AttributeInput } from "@saleor/components/Attributes";
import { WindowTitle } from "@saleor/components/WindowTitle"; import { WindowTitle } from "@saleor/components/WindowTitle";
import { DEFAULT_INITIAL_SEARCH_DATA } from "@saleor/config"; import {
DEFAULT_INITIAL_SEARCH_DATA,
VALUES_PAGINATE_BY
} from "@saleor/config";
import { useFileUploadMutation } from "@saleor/files/mutations"; import { useFileUploadMutation } from "@saleor/files/mutations";
import { AttributeErrorFragment } from "@saleor/fragments/types/AttributeErrorFragment"; import { AttributeErrorFragment } from "@saleor/fragments/types/AttributeErrorFragment";
import { PageErrorFragment } from "@saleor/fragments/types/PageErrorFragment"; import { PageErrorFragment } from "@saleor/fragments/types/PageErrorFragment";
@ -21,6 +24,7 @@ import { UploadErrorFragment } from "@saleor/fragments/types/UploadErrorFragment
import useNavigator from "@saleor/hooks/useNavigator"; import useNavigator from "@saleor/hooks/useNavigator";
import useNotifier from "@saleor/hooks/useNotifier"; import useNotifier from "@saleor/hooks/useNotifier";
import { commonMessages } from "@saleor/intl"; import { commonMessages } from "@saleor/intl";
import useAttributeValueSearch from "@saleor/searches/useAttributeValueSearch";
import usePageSearch from "@saleor/searches/usePageSearch"; import usePageSearch from "@saleor/searches/usePageSearch";
import useProductSearch from "@saleor/searches/useProductSearch"; import useProductSearch from "@saleor/searches/useProductSearch";
import createMetadataUpdateHandler from "@saleor/utils/handlers/metadataUpdateHandler"; import createMetadataUpdateHandler from "@saleor/utils/handlers/metadataUpdateHandler";
@ -30,7 +34,7 @@ import {
usePrivateMetadataUpdate usePrivateMetadataUpdate
} from "@saleor/utils/metadata/updateMetadata"; } from "@saleor/utils/metadata/updateMetadata";
import { getParsedDataForJsonStringField } from "@saleor/utils/richText/misc"; import { getParsedDataForJsonStringField } from "@saleor/utils/richText/misc";
import React from "react"; import React, { useState } from "react";
import { FormattedMessage, useIntl } from "react-intl"; import { FormattedMessage, useIntl } from "react-intl";
import { getStringOrPlaceholder, maybe } from "../../misc"; import { getStringOrPlaceholder, maybe } from "../../misc";
@ -75,7 +79,8 @@ export const PageDetails: React.FC<PageDetailsProps> = ({ id, params }) => {
const pageDetails = usePageDetailsQuery({ const pageDetails = usePageDetailsQuery({
variables: { variables: {
id id,
firstValues: VALUES_PAGINATE_BY
} }
}); });
@ -132,7 +137,8 @@ export const PageDetails: React.FC<PageDetailsProps> = ({ id, params }) => {
const updateResult = await pageUpdate({ const updateResult = await pageUpdate({
variables: { variables: {
id, id,
input: createPageInput(data, updatedFileAttributes) input: createPageInput(data, updatedFileAttributes),
firstValues: VALUES_PAGINATE_BY
} }
}); });
@ -160,7 +166,6 @@ export const PageDetails: React.FC<PageDetailsProps> = ({ id, params }) => {
} = usePageSearch({ } = usePageSearch({
variables: DEFAULT_INITIAL_SEARCH_DATA variables: DEFAULT_INITIAL_SEARCH_DATA
}); });
const { const {
loadMore: loadMoreProducts, loadMore: loadMoreProducts,
search: searchProducts, search: searchProducts,
@ -168,18 +173,39 @@ export const PageDetails: React.FC<PageDetailsProps> = ({ id, params }) => {
} = useProductSearch({ } = useProductSearch({
variables: DEFAULT_INITIAL_SEARCH_DATA variables: DEFAULT_INITIAL_SEARCH_DATA
}); });
const [focusedAttribute, setFocusedAttribute] = useState<string>();
const {
loadMore: loadMoreAttributeValues,
search: searchAttributeValues,
result: searchAttributeValuesOpts
} = useAttributeValueSearch({
variables: {
id: focusedAttribute,
...DEFAULT_INITIAL_SEARCH_DATA
},
skip: !focusedAttribute
});
const attributeValues = mapEdgesToItems(
searchAttributeValuesOpts?.data?.attribute.choices
);
const fetchMoreReferencePages = { const fetchMoreReferencePages = {
hasMore: searchPagesOpts.data?.search?.pageInfo?.hasNextPage, hasMore: searchPagesOpts.data?.search?.pageInfo?.hasNextPage,
loading: searchPagesOpts.loading, loading: searchPagesOpts.loading,
onFetchMore: loadMorePages onFetchMore: loadMorePages
}; };
const fetchMoreReferenceProducts = { const fetchMoreReferenceProducts = {
hasMore: searchProductsOpts.data?.search?.pageInfo?.hasNextPage, hasMore: searchProductsOpts.data?.search?.pageInfo?.hasNextPage,
loading: searchProductsOpts.loading, loading: searchProductsOpts.loading,
onFetchMore: loadMoreProducts onFetchMore: loadMoreProducts
}; };
const fetchMoreAttributeValues = {
hasMore: !!searchAttributeValuesOpts.data?.attribute?.choices?.pageInfo
?.hasNextPage,
loading: !!searchAttributeValuesOpts.loading,
onFetchMore: loadMoreAttributeValues
};
return ( return (
<> <>
@ -194,6 +220,7 @@ export const PageDetails: React.FC<PageDetailsProps> = ({ id, params }) => {
errors={pageUpdateOpts.data?.pageUpdate.errors || []} errors={pageUpdateOpts.data?.pageUpdate.errors || []}
saveButtonBarState={pageUpdateOpts.status} saveButtonBarState={pageUpdateOpts.status}
page={pageDetails.data?.page} page={pageDetails.data?.page}
attributeValues={attributeValues}
onBack={() => navigate(pageListUrl())} onBack={() => navigate(pageListUrl())}
onRemove={() => onRemove={() =>
navigate( navigate(
@ -213,7 +240,10 @@ export const PageDetails: React.FC<PageDetailsProps> = ({ id, params }) => {
fetchMoreReferencePages={fetchMoreReferencePages} fetchMoreReferencePages={fetchMoreReferencePages}
fetchReferenceProducts={searchProducts} fetchReferenceProducts={searchProducts}
fetchMoreReferenceProducts={fetchMoreReferenceProducts} fetchMoreReferenceProducts={fetchMoreReferenceProducts}
fetchAttributeValues={searchAttributeValues}
fetchMoreAttributeValues={fetchMoreAttributeValues}
onCloseDialog={() => navigate(pageUrl(id))} onCloseDialog={() => navigate(pageUrl(id))}
onAttributeFocus={setFocusedAttribute}
/> />
<ActionDialog <ActionDialog
open={params.action === "remove"} open={params.action === "remove"}

View file

@ -23,8 +23,20 @@ export const attributes: ProductType_productType_productAttributes[] = [
slug: "author", slug: "author",
valueRequired: true, valueRequired: true,
unit: null, unit: null,
values: [ choices: {
__typename: "AttributeValueCountableConnection" as "AttributeValueCountableConnection",
pageInfo: {
endCursor: "WyI4IiwgIjMiXQ==",
hasNextPage: false,
hasPreviousPage: false,
startCursor: "WyIwIiwgIjQ5Il0=",
__typename: "PageInfo" as "PageInfo"
},
edges: [
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjI0", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjI0",
@ -35,8 +47,12 @@ export const attributes: ProductType_productType_productAttributes[] = [
type: "STRING", type: "STRING",
value: "", value: "",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjI1", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjI1",
@ -48,8 +64,10 @@ export const attributes: ProductType_productType_productAttributes[] = [
value: "", value: "",
richText: null richText: null
} }
}
] ]
} }
}
}, },
{ {
node: { node: {
@ -61,8 +79,20 @@ export const attributes: ProductType_productType_productAttributes[] = [
slug: "box-size", slug: "box-size",
valueRequired: true, valueRequired: true,
unit: null, unit: null,
values: [ choices: {
__typename: "AttributeValueCountableConnection" as "AttributeValueCountableConnection",
pageInfo: {
endCursor: "WyI4IiwgIjMiXQ==",
hasNextPage: false,
hasPreviousPage: false,
startCursor: "WyIwIiwgIjQ5Il0=",
__typename: "PageInfo" as "PageInfo"
},
edges: [
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjE1", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjE1",
@ -73,8 +103,12 @@ export const attributes: ProductType_productType_productAttributes[] = [
type: "STRING", type: "STRING",
value: "", value: "",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjE2", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjE2",
@ -85,8 +119,12 @@ export const attributes: ProductType_productType_productAttributes[] = [
type: "STRING", type: "STRING",
value: "", value: "",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjE3", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjE3",
@ -97,8 +135,12 @@ export const attributes: ProductType_productType_productAttributes[] = [
type: "STRING", type: "STRING",
value: "", value: "",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjE4", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjE4",
@ -110,8 +152,10 @@ export const attributes: ProductType_productType_productAttributes[] = [
value: "", value: "",
richText: null richText: null
} }
}
] ]
} }
}
}, },
{ {
node: { node: {
@ -123,8 +167,20 @@ export const attributes: ProductType_productType_productAttributes[] = [
slug: "brand", slug: "brand",
valueRequired: true, valueRequired: true,
unit: null, unit: null,
values: [ choices: {
__typename: "AttributeValueCountableConnection" as "AttributeValueCountableConnection",
pageInfo: {
endCursor: "WyI4IiwgIjMiXQ==",
hasNextPage: false,
hasPreviousPage: false,
startCursor: "WyIwIiwgIjQ5Il0=",
__typename: "PageInfo" as "PageInfo"
},
edges: [
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjY=", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjY=",
@ -136,8 +192,10 @@ export const attributes: ProductType_productType_productAttributes[] = [
value: "", value: "",
richText: null richText: null
} }
}
] ]
} }
}
}, },
{ {
node: { node: {
@ -149,8 +207,20 @@ export const attributes: ProductType_productType_productAttributes[] = [
slug: "candy-box-size", slug: "candy-box-size",
valueRequired: true, valueRequired: true,
unit: null, unit: null,
values: [ choices: {
__typename: "AttributeValueCountableConnection" as "AttributeValueCountableConnection",
pageInfo: {
endCursor: "WyI4IiwgIjMiXQ==",
hasNextPage: false,
hasPreviousPage: false,
startCursor: "WyIwIiwgIjQ5Il0=",
__typename: "PageInfo" as "PageInfo"
},
edges: [
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjIx", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjIx",
@ -161,8 +231,12 @@ export const attributes: ProductType_productType_productAttributes[] = [
type: "STRING", type: "STRING",
value: "", value: "",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjIy", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjIy",
@ -173,8 +247,12 @@ export const attributes: ProductType_productType_productAttributes[] = [
type: "STRING", type: "STRING",
value: "", value: "",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjIz", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjIz",
@ -186,8 +264,10 @@ export const attributes: ProductType_productType_productAttributes[] = [
value: "", value: "",
richText: null richText: null
} }
}
] ]
} }
}
}, },
{ {
node: { node: {
@ -199,8 +279,20 @@ export const attributes: ProductType_productType_productAttributes[] = [
slug: "coffee-genre", slug: "coffee-genre",
valueRequired: true, valueRequired: true,
unit: null, unit: null,
values: [ choices: {
__typename: "AttributeValueCountableConnection" as "AttributeValueCountableConnection",
pageInfo: {
endCursor: "WyI4IiwgIjMiXQ==",
hasNextPage: false,
hasPreviousPage: false,
startCursor: "WyIwIiwgIjQ5Il0=",
__typename: "PageInfo" as "PageInfo"
},
edges: [
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjEz", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjEz",
@ -211,8 +303,12 @@ export const attributes: ProductType_productType_productAttributes[] = [
type: "STRING", type: "STRING",
value: "", value: "",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjE0", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjE0",
@ -224,8 +320,10 @@ export const attributes: ProductType_productType_productAttributes[] = [
value: "", value: "",
richText: null richText: null
} }
}
] ]
} }
}
}, },
{ {
node: { node: {
@ -237,8 +335,20 @@ export const attributes: ProductType_productType_productAttributes[] = [
slug: "collar", slug: "collar",
valueRequired: true, valueRequired: true,
unit: null, unit: null,
values: [ choices: {
__typename: "AttributeValueCountableConnection" as "AttributeValueCountableConnection",
pageInfo: {
endCursor: "WyI4IiwgIjMiXQ==",
hasNextPage: false,
hasPreviousPage: false,
startCursor: "WyIwIiwgIjQ5Il0=",
__typename: "PageInfo" as "PageInfo"
},
edges: [
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjM=", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjM=",
@ -249,8 +359,12 @@ export const attributes: ProductType_productType_productAttributes[] = [
type: "STRING", type: "STRING",
value: "", value: "",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjQ=", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjQ=",
@ -261,8 +375,12 @@ export const attributes: ProductType_productType_productAttributes[] = [
type: "STRING", type: "STRING",
value: "", value: "",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjU=", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjU=",
@ -274,8 +392,10 @@ export const attributes: ProductType_productType_productAttributes[] = [
value: "", value: "",
richText: null richText: null
} }
}
] ]
} }
}
}, },
{ {
node: { node: {
@ -287,8 +407,20 @@ export const attributes: ProductType_productType_productAttributes[] = [
slug: "color", slug: "color",
valueRequired: true, valueRequired: true,
unit: null, unit: null,
values: [ choices: {
__typename: "AttributeValueCountableConnection" as "AttributeValueCountableConnection",
pageInfo: {
endCursor: "WyI4IiwgIjMiXQ==",
hasNextPage: false,
hasPreviousPage: false,
startCursor: "WyIwIiwgIjQ5Il0=",
__typename: "PageInfo" as "PageInfo"
},
edges: [
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjE=", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjE=",
@ -299,8 +431,12 @@ export const attributes: ProductType_productType_productAttributes[] = [
type: "STRING", type: "STRING",
value: "", value: "",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjI=", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjI=",
@ -312,8 +448,10 @@ export const attributes: ProductType_productType_productAttributes[] = [
value: "", value: "",
richText: null richText: null
} }
}
] ]
} }
}
}, },
{ {
node: { node: {
@ -325,8 +463,20 @@ export const attributes: ProductType_productType_productAttributes[] = [
slug: "cover", slug: "cover",
valueRequired: true, valueRequired: true,
unit: null, unit: null,
values: [ choices: {
__typename: "AttributeValueCountableConnection" as "AttributeValueCountableConnection",
pageInfo: {
endCursor: "WyI4IiwgIjMiXQ==",
hasNextPage: false,
hasPreviousPage: false,
startCursor: "WyIwIiwgIjQ5Il0=",
__typename: "PageInfo" as "PageInfo"
},
edges: [
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjMw", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjMw",
@ -337,8 +487,12 @@ export const attributes: ProductType_productType_productAttributes[] = [
type: "STRING", type: "STRING",
value: "", value: "",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjMx", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjMx",
@ -349,8 +503,12 @@ export const attributes: ProductType_productType_productAttributes[] = [
type: "STRING", type: "STRING",
value: "", value: "",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjMy", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjMy",
@ -361,8 +519,12 @@ export const attributes: ProductType_productType_productAttributes[] = [
type: "STRING", type: "STRING",
value: "", value: "",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjMz", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjMz",
@ -373,8 +535,12 @@ export const attributes: ProductType_productType_productAttributes[] = [
type: "STRING", type: "STRING",
value: "", value: "",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjM0", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjM0",
@ -385,8 +551,12 @@ export const attributes: ProductType_productType_productAttributes[] = [
type: "STRING", type: "STRING",
value: "", value: "",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjM1", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjM1",
@ -398,8 +568,10 @@ export const attributes: ProductType_productType_productAttributes[] = [
value: "", value: "",
richText: null richText: null
} }
}
] ]
} }
}
}, },
{ {
node: { node: {
@ -411,8 +583,20 @@ export const attributes: ProductType_productType_productAttributes[] = [
slug: "flavor", slug: "flavor",
valueRequired: true, valueRequired: true,
unit: null, unit: null,
values: [ choices: {
__typename: "AttributeValueCountableConnection" as "AttributeValueCountableConnection",
pageInfo: {
endCursor: "WyI4IiwgIjMiXQ==",
hasNextPage: false,
hasPreviousPage: false,
startCursor: "WyIwIiwgIjQ5Il0=",
__typename: "PageInfo" as "PageInfo"
},
edges: [
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjE5", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjE5",
@ -423,8 +607,12 @@ export const attributes: ProductType_productType_productAttributes[] = [
type: "STRING", type: "STRING",
value: "", value: "",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjIw", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjIw",
@ -436,8 +624,10 @@ export const attributes: ProductType_productType_productAttributes[] = [
value: "", value: "",
richText: null richText: null
} }
}
] ]
} }
}
}, },
{ {
node: { node: {
@ -449,8 +639,20 @@ export const attributes: ProductType_productType_productAttributes[] = [
slug: "language", slug: "language",
valueRequired: true, valueRequired: true,
unit: null, unit: null,
values: [ choices: {
__typename: "AttributeValueCountableConnection" as "AttributeValueCountableConnection",
pageInfo: {
endCursor: "WyI4IiwgIjMiXQ==",
hasNextPage: false,
hasPreviousPage: false,
startCursor: "WyIwIiwgIjQ5Il0=",
__typename: "PageInfo" as "PageInfo"
},
edges: [
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjI4", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjI4",
@ -461,8 +663,12 @@ export const attributes: ProductType_productType_productAttributes[] = [
type: "STRING", type: "STRING",
value: "", value: "",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjI5", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjI5",
@ -474,8 +680,10 @@ export const attributes: ProductType_productType_productAttributes[] = [
value: "", value: "",
richText: null richText: null
} }
}
] ]
} }
}
}, },
{ {
node: { node: {
@ -487,8 +695,20 @@ export const attributes: ProductType_productType_productAttributes[] = [
slug: "publisher", slug: "publisher",
valueRequired: true, valueRequired: true,
unit: null, unit: null,
values: [ choices: {
__typename: "AttributeValueCountableConnection" as "AttributeValueCountableConnection",
pageInfo: {
endCursor: "WyI4IiwgIjMiXQ==",
hasNextPage: false,
hasPreviousPage: false,
startCursor: "WyIwIiwgIjQ5Il0=",
__typename: "PageInfo" as "PageInfo"
},
edges: [
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjI2", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjI2",
@ -499,8 +719,12 @@ export const attributes: ProductType_productType_productAttributes[] = [
type: "STRING", type: "STRING",
value: "", value: "",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjI3", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjI3",
@ -512,8 +736,10 @@ export const attributes: ProductType_productType_productAttributes[] = [
value: "", value: "",
richText: null richText: null
} }
}
] ]
} }
}
}, },
{ {
node: { node: {
@ -525,8 +751,20 @@ export const attributes: ProductType_productType_productAttributes[] = [
slug: "size", slug: "size",
valueRequired: true, valueRequired: true,
unit: null, unit: null,
values: [ choices: {
__typename: "AttributeValueCountableConnection" as "AttributeValueCountableConnection",
pageInfo: {
endCursor: "WyI4IiwgIjMiXQ==",
hasNextPage: false,
hasPreviousPage: false,
startCursor: "WyIwIiwgIjQ5Il0=",
__typename: "PageInfo" as "PageInfo"
},
edges: [
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjc=", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjc=",
@ -537,8 +775,12 @@ export const attributes: ProductType_productType_productAttributes[] = [
type: "STRING", type: "STRING",
value: "", value: "",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjg=", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjg=",
@ -549,8 +791,12 @@ export const attributes: ProductType_productType_productAttributes[] = [
type: "STRING", type: "STRING",
value: "", value: "",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjk=", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjk=",
@ -561,8 +807,12 @@ export const attributes: ProductType_productType_productAttributes[] = [
type: "STRING", type: "STRING",
value: "", value: "",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjEw", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjEw",
@ -573,8 +823,12 @@ export const attributes: ProductType_productType_productAttributes[] = [
type: "STRING", type: "STRING",
value: "", value: "",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjEx", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjEx",
@ -585,8 +839,12 @@ export const attributes: ProductType_productType_productAttributes[] = [
type: "STRING", type: "STRING",
value: "", value: "",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge" as "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue" as "AttributeValue", __typename: "AttributeValue" as "AttributeValue",
file: null, file: null,
id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjEy", id: "UHJvZHVjdEF0dHJpYnV0ZVZhbHVlOjEy",
@ -598,9 +856,11 @@ export const attributes: ProductType_productType_productAttributes[] = [
value: "", value: "",
richText: null richText: null
} }
}
] ]
} }
} }
}
].map(edge => edge.node); ].map(edge => edge.node);
export const productTypeSearch: ProductType_productType = { export const productTypeSearch: ProductType_productType = {

View file

@ -25,6 +25,7 @@ import { sectionNames } from "@saleor/intl";
import ProductVariantPrice from "@saleor/products/components/ProductVariantPrice"; import ProductVariantPrice from "@saleor/products/components/ProductVariantPrice";
import { ProductType_productType } from "@saleor/products/types/ProductType"; import { ProductType_productType } from "@saleor/products/types/ProductType";
import { getChoices } from "@saleor/products/utils/data"; import { getChoices } from "@saleor/products/utils/data";
import { SearchAttributeValues_attribute_choices_edges_node } from "@saleor/searches/types/SearchAttributeValues";
import { SearchCategories_search_edges_node } from "@saleor/searches/types/SearchCategories"; import { SearchCategories_search_edges_node } from "@saleor/searches/types/SearchCategories";
import { SearchCollections_search_edges_node } from "@saleor/searches/types/SearchCollections"; import { SearchCollections_search_edges_node } from "@saleor/searches/types/SearchCollections";
import { SearchPages_search_edges_node } from "@saleor/searches/types/SearchPages"; import { SearchPages_search_edges_node } from "@saleor/searches/types/SearchPages";
@ -54,10 +55,12 @@ interface ProductCreatePageProps {
currentChannels: ChannelData[]; currentChannels: ChannelData[];
collections: SearchCollections_search_edges_node[]; collections: SearchCollections_search_edges_node[];
categories: SearchCategories_search_edges_node[]; categories: SearchCategories_search_edges_node[];
attributeValues: SearchAttributeValues_attribute_choices_edges_node[];
loading: boolean; loading: boolean;
fetchMoreCategories: FetchMoreProps; fetchMoreCategories: FetchMoreProps;
fetchMoreCollections: FetchMoreProps; fetchMoreCollections: FetchMoreProps;
fetchMoreProductTypes: FetchMoreProps; fetchMoreProductTypes: FetchMoreProps;
fetchMoreAttributeValues?: FetchMoreProps;
initial?: Partial<ProductCreateFormData>; initial?: Partial<ProductCreateFormData>;
productTypes?: SearchProductTypes_search_edges_node[]; productTypes?: SearchProductTypes_search_edges_node[];
referencePages?: SearchPages_search_edges_node[]; referencePages?: SearchPages_search_edges_node[];
@ -71,6 +74,8 @@ interface ProductCreatePageProps {
fetchCategories: (data: string) => void; fetchCategories: (data: string) => void;
fetchCollections: (data: string) => void; fetchCollections: (data: string) => void;
fetchProductTypes: (data: string) => void; fetchProductTypes: (data: string) => void;
fetchAttributeValues: (query: string) => void;
onAttributeFocus: (id: string) => void;
onWarehouseConfigure: () => void; onWarehouseConfigure: () => void;
openChannelsModal: () => void; openChannelsModal: () => void;
onChannelsChange: (data: ChannelData[]) => void; onChannelsChange: (data: ChannelData[]) => void;
@ -93,6 +98,7 @@ export const ProductCreatePage: React.FC<ProductCreatePageProps> = ({
loading, loading,
categories: categoryChoiceList, categories: categoryChoiceList,
collections: collectionChoiceList, collections: collectionChoiceList,
attributeValues,
errors, errors,
fetchCategories, fetchCategories,
fetchCollections, fetchCollections,
@ -121,8 +127,11 @@ export const ProductCreatePage: React.FC<ProductCreatePageProps> = ({
fetchMoreReferencePages, fetchMoreReferencePages,
fetchReferenceProducts, fetchReferenceProducts,
fetchMoreReferenceProducts, fetchMoreReferenceProducts,
fetchAttributeValues,
fetchMoreAttributeValues,
onCloseDialog, onCloseDialog,
onSelectProductType onSelectProductType,
onAttributeFocus
}: ProductCreatePageProps) => { }: ProductCreatePageProps) => {
const intl = useIntl(); const intl = useIntl();
@ -185,7 +194,6 @@ export const ProductCreatePage: React.FC<ProductCreatePageProps> = ({
taxTypes={taxTypeChoices} taxTypes={taxTypeChoices}
warehouses={warehouses} warehouses={warehouses}
currentChannels={currentChannels} currentChannels={currentChannels}
productTypeChoiceList={productTypeChoiceList}
fetchReferencePages={fetchReferencePages} fetchReferencePages={fetchReferencePages}
fetchMoreReferencePages={fetchMoreReferencePages} fetchMoreReferencePages={fetchMoreReferencePages}
fetchReferenceProducts={fetchReferenceProducts} fetchReferenceProducts={fetchReferenceProducts}
@ -222,6 +230,7 @@ export const ProductCreatePage: React.FC<ProductCreatePageProps> = ({
{data.attributes.length > 0 && ( {data.attributes.length > 0 && (
<Attributes <Attributes
attributes={data.attributes} attributes={data.attributes}
attributeValues={attributeValues}
loading={loading} loading={loading}
disabled={loading} disabled={loading}
errors={errors} errors={errors}
@ -231,6 +240,9 @@ export const ProductCreatePage: React.FC<ProductCreatePageProps> = ({
onReferencesRemove={handlers.selectAttributeReference} onReferencesRemove={handlers.selectAttributeReference}
onReferencesAddClick={onAssignReferencesClick} onReferencesAddClick={onAssignReferencesClick}
onReferencesReorder={handlers.reorderAttributeValue} onReferencesReorder={handlers.reorderAttributeValue}
fetchAttributeValues={fetchAttributeValues}
fetchMoreAttributeValues={fetchMoreAttributeValues}
onAttributeFocus={onAttributeFocus}
/> />
)} )}
<CardSpacer /> <CardSpacer />

View file

@ -129,7 +129,6 @@ export interface UseProductCreateFormOpts
productTypes: SearchProductTypes_search_edges_node[]; productTypes: SearchProductTypes_search_edges_node[];
warehouses: SearchWarehouses_search_edges_node[]; warehouses: SearchWarehouses_search_edges_node[];
currentChannels: ChannelData[]; currentChannels: ChannelData[];
productTypeChoiceList: SearchProductTypes_search_edges_node[];
referencePages: SearchPages_search_edges_node[]; referencePages: SearchPages_search_edges_node[];
referenceProducts: SearchProducts_search_edges_node[]; referenceProducts: SearchProducts_search_edges_node[];
fetchReferencePages?: (data: string) => void; fetchReferencePages?: (data: string) => void;

View file

@ -36,8 +36,10 @@ const props: ProductUpdatePageProps = {
errors: [], errors: [],
fetchCategories: () => undefined, fetchCategories: () => undefined,
fetchCollections: () => undefined, fetchCollections: () => undefined,
fetchAttributeValues: () => undefined,
fetchMoreCategories: fetchMoreProps, fetchMoreCategories: fetchMoreProps,
fetchMoreCollections: fetchMoreProps, fetchMoreCollections: fetchMoreProps,
fetchMoreAttributeValues: fetchMoreProps,
hasChannelChanged: false, hasChannelChanged: false,
header: product.name, header: product.name,
media: product.media, media: product.media,
@ -58,6 +60,7 @@ const props: ProductUpdatePageProps = {
onVariantsAdd: () => undefined, onVariantsAdd: () => undefined,
onWarehouseConfigure: () => undefined, onWarehouseConfigure: () => undefined,
openChannelsModal: () => undefined, openChannelsModal: () => undefined,
onAttributeFocus: () => undefined,
placeholderImage, placeholderImage,
product, product,
referencePages: [], referencePages: [],
@ -66,7 +69,8 @@ const props: ProductUpdatePageProps = {
selectedChannelId: "123", selectedChannelId: "123",
taxTypes, taxTypes,
variants: product.variants, variants: product.variants,
warehouses: warehouseList warehouses: warehouseList,
attributeValues: []
}; };
const selectors = { const selectors = {

View file

@ -29,6 +29,7 @@ import { maybe } from "@saleor/misc";
import ProductExternalMediaDialog from "@saleor/products/components/ProductExternalMediaDialog"; import ProductExternalMediaDialog from "@saleor/products/components/ProductExternalMediaDialog";
import ProductVariantPrice from "@saleor/products/components/ProductVariantPrice"; import ProductVariantPrice from "@saleor/products/components/ProductVariantPrice";
import { ChannelsWithVariantsData } from "@saleor/products/views/ProductUpdate/types"; import { ChannelsWithVariantsData } from "@saleor/products/views/ProductUpdate/types";
import { SearchAttributeValues_attribute_choices_edges_node } from "@saleor/searches/types/SearchAttributeValues";
import { SearchCategories_search_edges_node } from "@saleor/searches/types/SearchCategories"; import { SearchCategories_search_edges_node } from "@saleor/searches/types/SearchCategories";
import { SearchCollections_search_edges_node } from "@saleor/searches/types/SearchCollections"; import { SearchCollections_search_edges_node } from "@saleor/searches/types/SearchCollections";
import { SearchPages_search_edges_node } from "@saleor/searches/types/SearchPages"; import { SearchPages_search_edges_node } from "@saleor/searches/types/SearchPages";
@ -75,6 +76,7 @@ export interface ProductUpdatePageProps extends ListActions, ChannelProps {
placeholderImage: string; placeholderImage: string;
collections: SearchCollections_search_edges_node[]; collections: SearchCollections_search_edges_node[];
categories: SearchCategories_search_edges_node[]; categories: SearchCategories_search_edges_node[];
attributeValues: SearchAttributeValues_attribute_choices_edges_node[];
disabled: boolean; disabled: boolean;
fetchMoreCategories: FetchMoreProps; fetchMoreCategories: FetchMoreProps;
fetchMoreCollections: FetchMoreProps; fetchMoreCollections: FetchMoreProps;
@ -93,11 +95,14 @@ export interface ProductUpdatePageProps extends ListActions, ChannelProps {
assignReferencesAttributeId?: string; assignReferencesAttributeId?: string;
fetchMoreReferencePages?: FetchMoreProps; fetchMoreReferencePages?: FetchMoreProps;
fetchMoreReferenceProducts?: FetchMoreProps; fetchMoreReferenceProducts?: FetchMoreProps;
fetchMoreAttributeValues?: FetchMoreProps;
isSimpleProduct: boolean; isSimpleProduct: boolean;
fetchCategories: (query: string) => void; fetchCategories: (query: string) => void;
fetchCollections: (query: string) => void; fetchCollections: (query: string) => void;
fetchReferencePages?: (data: string) => void; fetchReferencePages?: (data: string) => void;
fetchReferenceProducts?: (data: string) => void; fetchReferenceProducts?: (data: string) => void;
fetchAttributeValues: (query: string) => void;
onAttributeFocus: (id: string) => void;
onAssignReferencesClick: (attribute: AttributeInput) => void; onAssignReferencesClick: (attribute: AttributeInput) => void;
onCloseDialog: () => void; onCloseDialog: () => void;
onVariantsAdd: () => void; onVariantsAdd: () => void;
@ -134,6 +139,7 @@ export const ProductUpdatePage: React.FC<ProductUpdatePageProps> = ({
categories: categoryChoiceList, categories: categoryChoiceList,
channelsErrors, channelsErrors,
collections: collectionChoiceList, collections: collectionChoiceList,
attributeValues,
isSimpleProduct, isSimpleProduct,
errors, errors,
fetchCategories, fetchCategories,
@ -185,9 +191,12 @@ export const ProductUpdatePage: React.FC<ProductUpdatePageProps> = ({
fetchMoreReferencePages, fetchMoreReferencePages,
fetchReferenceProducts, fetchReferenceProducts,
fetchMoreReferenceProducts, fetchMoreReferenceProducts,
fetchAttributeValues,
fetchMoreAttributeValues,
onCloseDialog, onCloseDialog,
channelsWithVariantsData, channelsWithVariantsData,
onChannelsChange onChannelsChange,
onAttributeFocus
}) => { }) => {
const intl = useIntl(); const intl = useIntl();
@ -298,6 +307,7 @@ export const ProductUpdatePage: React.FC<ProductUpdatePageProps> = ({
{data.attributes.length > 0 && ( {data.attributes.length > 0 && (
<Attributes <Attributes
attributes={data.attributes} attributes={data.attributes}
attributeValues={attributeValues}
errors={errors} errors={errors}
loading={disabled} loading={disabled}
disabled={disabled} disabled={disabled}
@ -307,6 +317,9 @@ export const ProductUpdatePage: React.FC<ProductUpdatePageProps> = ({
onReferencesRemove={handlers.selectAttributeReference} onReferencesRemove={handlers.selectAttributeReference}
onReferencesAddClick={onAssignReferencesClick} onReferencesAddClick={onAssignReferencesClick}
onReferencesReorder={handlers.reorderAttributeValue} onReferencesReorder={handlers.reorderAttributeValue}
fetchAttributeValues={fetchAttributeValues}
fetchMoreAttributeValues={fetchMoreAttributeValues}
onAttributeFocus={onAttributeFocus}
/> />
)} )}
<CardSpacer /> <CardSpacer />

View file

@ -8,8 +8,8 @@ import SingleAutocompleteSelectField, {
import Skeleton from "@saleor/components/Skeleton"; import Skeleton from "@saleor/components/Skeleton";
import { ProductErrorWithAttributesFragment } from "@saleor/fragments/types/ProductErrorWithAttributesFragment"; import { ProductErrorWithAttributesFragment } from "@saleor/fragments/types/ProductErrorWithAttributesFragment";
import { import {
ProductVariant_nonSelectionAttributes_attribute_values, ProductVariant_nonSelectionAttributes_attribute_choices_edges,
ProductVariant_selectionAttributes_attribute_values ProductVariant_selectionAttributes_attribute_choices_edges
} from "@saleor/fragments/types/ProductVariant"; } from "@saleor/fragments/types/ProductVariant";
import { FormsetAtomicData, FormsetChange } from "@saleor/hooks/useFormset"; import { FormsetAtomicData, FormsetChange } from "@saleor/hooks/useFormset";
import { commonMessages } from "@saleor/intl"; import { commonMessages } from "@saleor/intl";
@ -19,8 +19,8 @@ import { useIntl } from "react-intl";
export interface VariantAttributeInputData { export interface VariantAttributeInputData {
values: Array< values: Array<
| ProductVariant_selectionAttributes_attribute_values | ProductVariant_selectionAttributes_attribute_choices_edges
| ProductVariant_nonSelectionAttributes_attribute_values | ProductVariant_nonSelectionAttributes_attribute_choices_edges
>; >;
} }
export type VariantAttributeInput = FormsetAtomicData< export type VariantAttributeInput = FormsetAtomicData<
@ -42,10 +42,10 @@ function getAttributeDisplayValue(
): string { ): string {
const attribute = attributes.find(attr => attr.id === id); const attribute = attributes.find(attr => attr.id === id);
const attributeValue = attribute.data.values.find( const attributeValue = attribute.data.values.find(
value => value.slug === slug value => value.node.slug === slug
); );
if (!!attributeValue) { if (!!attributeValue) {
return attributeValue.name; return attributeValue.node.name;
} }
return slug || ""; return slug || "";
@ -65,8 +65,8 @@ function getAttributeValueChoices(
): SingleAutocompleteChoiceType[] { ): SingleAutocompleteChoiceType[] {
const attribute = attributes.find(attr => attr.id === id); const attribute = attributes.find(attr => attr.id === id);
return attribute.data.values.map(attributeValue => ({ return attribute.data.values.map(attributeValue => ({
label: attributeValue.name, label: attributeValue.node.name,
value: attributeValue.slug value: attributeValue.node.slug
})); }));
} }

View file

@ -17,6 +17,7 @@ import Metadata from "@saleor/components/Metadata";
import PageHeader from "@saleor/components/PageHeader"; import PageHeader from "@saleor/components/PageHeader";
import SaveButtonBar from "@saleor/components/SaveButtonBar"; import SaveButtonBar from "@saleor/components/SaveButtonBar";
import { ProductErrorWithAttributesFragment } from "@saleor/fragments/types/ProductErrorWithAttributesFragment"; import { ProductErrorWithAttributesFragment } from "@saleor/fragments/types/ProductErrorWithAttributesFragment";
import { SearchAttributeValues_attribute_choices_edges_node } from "@saleor/searches/types/SearchAttributeValues";
import { SearchPages_search_edges_node } from "@saleor/searches/types/SearchPages"; import { SearchPages_search_edges_node } from "@saleor/searches/types/SearchPages";
import { SearchProducts_search_edges_node } from "@saleor/searches/types/SearchProducts"; import { SearchProducts_search_edges_node } from "@saleor/searches/types/SearchProducts";
import { SearchWarehouses_search_edges_node } from "@saleor/searches/types/SearchWarehouses"; import { SearchWarehouses_search_edges_node } from "@saleor/searches/types/SearchWarehouses";
@ -69,6 +70,7 @@ interface ProductVariantCreatePageProps {
weightUnit: string; weightUnit: string;
referencePages?: SearchPages_search_edges_node[]; referencePages?: SearchPages_search_edges_node[];
referenceProducts?: SearchProducts_search_edges_node[]; referenceProducts?: SearchProducts_search_edges_node[];
attributeValues: SearchAttributeValues_attribute_choices_edges_node[];
onBack: () => void; onBack: () => void;
onSubmit: (data: ProductVariantCreateData) => void; onSubmit: (data: ProductVariantCreateData) => void;
onVariantClick: (variantId: string) => void; onVariantClick: (variantId: string) => void;
@ -76,10 +78,13 @@ interface ProductVariantCreatePageProps {
onWarehouseConfigure: () => void; onWarehouseConfigure: () => void;
assignReferencesAttributeId?: string; assignReferencesAttributeId?: string;
onAssignReferencesClick: (attribute: AttributeInput) => void; onAssignReferencesClick: (attribute: AttributeInput) => void;
onAttributeFocus: (id: string) => void;
fetchReferencePages?: (data: string) => void; fetchReferencePages?: (data: string) => void;
fetchReferenceProducts?: (data: string) => void; fetchReferenceProducts?: (data: string) => void;
fetchAttributeValues: (query: string) => void;
fetchMoreReferencePages?: FetchMoreProps; fetchMoreReferencePages?: FetchMoreProps;
fetchMoreReferenceProducts?: FetchMoreProps; fetchMoreReferenceProducts?: FetchMoreProps;
fetchMoreAttributeValues?: FetchMoreProps;
onCloseDialog: () => void; onCloseDialog: () => void;
} }
@ -94,17 +99,21 @@ const ProductVariantCreatePage: React.FC<ProductVariantCreatePageProps> = ({
weightUnit, weightUnit,
referencePages = [], referencePages = [],
referenceProducts = [], referenceProducts = [],
attributeValues,
onBack, onBack,
onSubmit, onSubmit,
onVariantClick, onVariantClick,
onVariantReorder, onVariantReorder,
onWarehouseConfigure, onWarehouseConfigure,
onAttributeFocus,
assignReferencesAttributeId, assignReferencesAttributeId,
onAssignReferencesClick, onAssignReferencesClick,
fetchReferencePages, fetchReferencePages,
fetchReferenceProducts, fetchReferenceProducts,
fetchAttributeValues,
fetchMoreReferencePages, fetchMoreReferencePages,
fetchMoreReferenceProducts, fetchMoreReferenceProducts,
fetchMoreAttributeValues,
onCloseDialog onCloseDialog
}) => { }) => {
const intl = useIntl(); const intl = useIntl();
@ -173,6 +182,7 @@ const ProductVariantCreatePage: React.FC<ProductVariantCreatePageProps> = ({
attribute.data.variantAttributeScope === attribute.data.variantAttributeScope ===
VariantAttributeScope.NOT_VARIANT_SELECTION VariantAttributeScope.NOT_VARIANT_SELECTION
)} )}
attributeValues={attributeValues}
loading={disabled} loading={disabled}
disabled={disabled} disabled={disabled}
errors={errors} errors={errors}
@ -182,6 +192,9 @@ const ProductVariantCreatePage: React.FC<ProductVariantCreatePageProps> = ({
onReferencesRemove={handlers.selectAttributeReference} onReferencesRemove={handlers.selectAttributeReference}
onReferencesAddClick={onAssignReferencesClick} onReferencesAddClick={onAssignReferencesClick}
onReferencesReorder={handlers.reorderAttributeValue} onReferencesReorder={handlers.reorderAttributeValue}
fetchAttributeValues={fetchAttributeValues}
fetchMoreAttributeValues={fetchMoreAttributeValues}
onAttributeFocus={onAttributeFocus}
/> />
<CardSpacer /> <CardSpacer />
<Attributes <Attributes
@ -191,6 +204,7 @@ const ProductVariantCreatePage: React.FC<ProductVariantCreatePageProps> = ({
attribute.data.variantAttributeScope === attribute.data.variantAttributeScope ===
VariantAttributeScope.VARIANT_SELECTION VariantAttributeScope.VARIANT_SELECTION
)} )}
attributeValues={attributeValues}
loading={disabled} loading={disabled}
disabled={disabled} disabled={disabled}
errors={errors} errors={errors}
@ -200,6 +214,9 @@ const ProductVariantCreatePage: React.FC<ProductVariantCreatePageProps> = ({
onReferencesRemove={handlers.selectAttributeReference} onReferencesRemove={handlers.selectAttributeReference}
onReferencesAddClick={onAssignReferencesClick} onReferencesAddClick={onAssignReferencesClick}
onReferencesReorder={handlers.reorderAttributeValue} onReferencesReorder={handlers.reorderAttributeValue}
fetchAttributeValues={fetchAttributeValues}
fetchMoreAttributeValues={fetchMoreAttributeValues}
onAttributeFocus={onAttributeFocus}
/> />
<CardSpacer /> <CardSpacer />
<ProductShipping <ProductShipping

View file

@ -1,7 +1,7 @@
import { attributes } from "@saleor/attributes/fixtures"; import { attributes } from "@saleor/attributes/fixtures";
import { productChannels } from "@saleor/channels/fixtures"; import { productChannels } from "@saleor/channels/fixtures";
import Container from "@saleor/components/Container"; import Container from "@saleor/components/Container";
import { limitsReached } from "@saleor/fixtures"; import { fetchMoreProps, limitsReached } from "@saleor/fixtures";
import { ProductVariantBulkCreate_productVariantBulkCreate_errors } from "@saleor/products/types/ProductVariantBulkCreate"; import { ProductVariantBulkCreate_productVariantBulkCreate_errors } from "@saleor/products/types/ProductVariantBulkCreate";
import { ProductErrorCode } from "@saleor/types/globalTypes"; import { ProductErrorCode } from "@saleor/types/globalTypes";
import { warehouseList } from "@saleor/warehouses/fixtures"; import { warehouseList } from "@saleor/warehouses/fixtures";
@ -34,8 +34,8 @@ const price: Price = {
attribute: selectedAttributes[0].id, attribute: selectedAttributes[0].id,
channels, channels,
mode: "attribute", mode: "attribute",
values: selectedAttributes[0].values.map(attribute => ({ values: selectedAttributes[0].choices.edges.map(attribute => ({
slug: attribute.slug, slug: attribute.node.slug,
value: channels value: channels
})) }))
}; };
@ -46,19 +46,24 @@ const stock: Stock = {
value: selectedWarehouses.map( value: selectedWarehouses.map(
(_, warehouseIndex) => (warehouseIndex + 2) * 3 (_, warehouseIndex) => (warehouseIndex + 2) * 3
), ),
values: selectedAttributes[0].values.map((attribute, attributeIndex) => ({ values: selectedAttributes[0].choices.edges.map(
slug: attribute.slug, (attribute, attributeIndex) => ({
slug: attribute.node.slug,
value: selectedWarehouses.map( value: selectedWarehouses.map(
(_, warehouseIndex) => (_, warehouseIndex) =>
selectedAttributes.length * 10 - attributeIndex - warehouseIndex * 3 selectedAttributes.length * 10 - attributeIndex - warehouseIndex * 3
) )
})) })
)
}; };
const dataAttributes = selectedAttributes.map(attribute => ({ const dataAttributes = selectedAttributes.map(attribute => ({
id: attribute.id, id: attribute.id,
values: attribute.values values: attribute.choices.edges
.map(value => value.slug) .map(value => ({
slug: value.node.slug,
value: value.node
}))
.filter((_, valueIndex) => valueIndex % 2 !== 1) .filter((_, valueIndex) => valueIndex % 2 !== 1)
})); }));
@ -87,6 +92,9 @@ const data: ProductVariantCreateFormData = {
}; };
const props: ProductVariantCreatorContentProps = { const props: ProductVariantCreatorContentProps = {
attributes: [0, 1, 4, 6].map(index => attributes[index]), attributes: [0, 1, 4, 6].map(index => attributes[index]),
attributeValues: [],
fetchAttributeValues: () => undefined,
fetchMoreAttributeValues: fetchMoreProps,
channelListings: productChannels.map(listing => ({ channelListings: productChannels.map(listing => ({
currency: listing.pricing?.priceRange?.start?.net.currency, currency: listing.pricing?.priceRange?.start?.net.currency,
id: listing.channel.id, id: listing.channel.id,
@ -101,7 +109,8 @@ const props: ProductVariantCreatorContentProps = {
errors: [], errors: [],
variantsLeft: 6, variantsLeft: 6,
step: ProductVariantCreatorStep.values, step: ProductVariantCreatorStep.values,
warehouses: warehouseList warehouses: warehouseList,
onAttributeFocus: () => undefined
}; };
storiesOf("Views / Products / Create multiple variants", module) storiesOf("Views / Products / Create multiple variants", module)

View file

@ -2,6 +2,8 @@ import { ChannelPriceData } from "@saleor/channels/utils";
import { WarehouseFragment } from "@saleor/fragments/types/WarehouseFragment"; import { WarehouseFragment } from "@saleor/fragments/types/WarehouseFragment";
import { ProductDetails_product_productType_variantAttributes } from "@saleor/products/types/ProductDetails"; import { ProductDetails_product_productType_variantAttributes } from "@saleor/products/types/ProductDetails";
import { ProductVariantBulkCreate_productVariantBulkCreate_errors } from "@saleor/products/types/ProductVariantBulkCreate"; import { ProductVariantBulkCreate_productVariantBulkCreate_errors } from "@saleor/products/types/ProductVariantBulkCreate";
import { SearchAttributeValues_attribute_choices_edges_node } from "@saleor/searches/types/SearchAttributeValues";
import { FetchMoreProps } from "@saleor/types";
import { isSelected } from "@saleor/utils/lists"; import { isSelected } from "@saleor/utils/lists";
import React from "react"; import React from "react";
@ -17,6 +19,7 @@ import { ProductVariantCreatorStep } from "./types";
export interface ProductVariantCreatorContentProps { export interface ProductVariantCreatorContentProps {
attributes: ProductDetails_product_productType_variantAttributes[]; attributes: ProductDetails_product_productType_variantAttributes[];
attributeValues: SearchAttributeValues_attribute_choices_edges_node[];
channelListings: ChannelPriceData[]; channelListings: ChannelPriceData[];
data: ProductVariantCreateFormData; data: ProductVariantCreateFormData;
dispatchFormDataAction: React.Dispatch<ProductVariantCreateReducerAction>; dispatchFormDataAction: React.Dispatch<ProductVariantCreateReducerAction>;
@ -24,17 +27,24 @@ export interface ProductVariantCreatorContentProps {
step: ProductVariantCreatorStep; step: ProductVariantCreatorStep;
variantsLeft: number | null; variantsLeft: number | null;
warehouses: WarehouseFragment[]; warehouses: WarehouseFragment[];
fetchAttributeValues: (query: string) => void;
fetchMoreAttributeValues?: FetchMoreProps;
onAttributeFocus: (id: string) => void;
} }
const ProductVariantCreatorContent: React.FC<ProductVariantCreatorContentProps> = ({ const ProductVariantCreatorContent: React.FC<ProductVariantCreatorContentProps> = ({
attributes, attributes,
attributeValues,
fetchAttributeValues,
fetchMoreAttributeValues,
channelListings, channelListings,
data, data,
dispatchFormDataAction, dispatchFormDataAction,
errors, errors,
step, step,
variantsLeft, variantsLeft,
warehouses warehouses,
onAttributeFocus
}) => { }) => {
const selectedAttributes = attributes.filter(attribute => const selectedAttributes = attributes.filter(attribute =>
isSelected( isSelected(
@ -49,17 +59,21 @@ const ProductVariantCreatorContent: React.FC<ProductVariantCreatorContentProps>
{step === ProductVariantCreatorStep.values && ( {step === ProductVariantCreatorStep.values && (
<ProductVariantCreateValues <ProductVariantCreateValues
attributes={selectedAttributes} attributes={selectedAttributes}
attributeValues={attributeValues}
fetchAttributeValues={fetchAttributeValues}
fetchMoreAttributeValues={fetchMoreAttributeValues}
data={data} data={data}
variantsLeft={variantsLeft} variantsLeft={variantsLeft}
onValueClick={(attributeId, valueId) => onValueClick={(attributeId, value) =>
dispatchFormDataAction({ dispatchFormDataAction({
selectValue: { selectValue: {
attributeId, attributeId,
valueId value
}, },
type: ProductVariantCreateReducerActionType.selectValue type: ProductVariantCreateReducerActionType.selectValue
}) })
} }
onAttributeFocus={onAttributeFocus}
/> />
)} )}
{step === ProductVariantCreatorStep.prices && ( {step === ProductVariantCreatorStep.prices && (

View file

@ -1,4 +1,5 @@
import { Button, Typography } from "@material-ui/core"; import { Button, Typography } from "@material-ui/core";
import { drawerWidthExpanded } from "@saleor/components/AppLayout/consts";
import Container from "@saleor/components/Container"; import Container from "@saleor/components/Container";
import Hr from "@saleor/components/Hr"; import Hr from "@saleor/components/Hr";
import PageHeader from "@saleor/components/PageHeader"; import PageHeader from "@saleor/components/PageHeader";
@ -28,8 +29,13 @@ const useStyles = makeStyles(
}, },
content: { content: {
overflowX: "visible", overflowX: "visible",
overflowY: "hidden", [theme.breakpoints.up("md")]: {
width: 800 position: "absolute",
width: `calc(100vw - ${drawerWidthExpanded}px + ${theme.spacing(6)}px)`,
maxWidth: `calc(${theme.breakpoints.width("lg")}px - ${theme.spacing(
6
)}px)`
}
}, },
description: { description: {
marginTop: theme.spacing() marginTop: theme.spacing()
@ -185,7 +191,7 @@ const ProductVariantCreatePage: React.FC<ProductVariantCreatePageProps> = props
React.useEffect(reloadForm, [attributes.length, warehouses.length]); React.useEffect(reloadForm, [attributes.length, warehouses.length]);
const variantsLeft = limits.allowedUsage.productVariants const variantsLeft = limits?.allowedUsage.productVariants
? limits.allowedUsage.productVariants - limits.currentUsage.productVariants ? limits.allowedUsage.productVariants - limits.currentUsage.productVariants
: null; : null;
@ -237,6 +243,7 @@ const ProductVariantCreatePage: React.FC<ProductVariantCreatePageProps> = props
)} )}
</PageHeader> </PageHeader>
<Hr className={classes.hr} /> <Hr className={classes.hr} />
<div className={classes.content}>
<ProductVariantCreatorContent <ProductVariantCreatorContent
{...contentProps} {...contentProps}
attributes={attributes} attributes={attributes}
@ -248,6 +255,7 @@ const ProductVariantCreatePage: React.FC<ProductVariantCreatePageProps> = props
step={step} step={step}
warehouses={warehouses} warehouses={warehouses}
/> />
</div>
</Container> </Container>
); );
}; };

View file

@ -20,7 +20,7 @@ import React from "react";
import { FormattedMessage, useIntl } from "react-intl"; import { FormattedMessage, useIntl } from "react-intl";
import { ProductDetails_product_productType_variantAttributes } from "../../types/ProductDetails"; import { ProductDetails_product_productType_variantAttributes } from "../../types/ProductDetails";
import { ChannelPrice, ProductVariantCreateFormData } from "./form"; import { Attribute, ChannelPrice, ProductVariantCreateFormData } from "./form";
export interface ProductVariantCreatorSummaryProps { export interface ProductVariantCreatorSummaryProps {
attributes: ProductDetails_product_productType_variantAttributes[]; attributes: ProductDetails_product_productType_variantAttributes[];
@ -113,18 +113,18 @@ const useStyles = makeStyles<ProductVariantCreatorSummaryProps, ClassKey>(
function getVariantName( function getVariantName(
variant: ProductVariantBulkCreateInput, variant: ProductVariantBulkCreateInput,
attributes: ProductDetails_product_productType_variantAttributes[] attributes: Attribute[]
): string[] { ): string[] {
return attributes.reduce( return attributes.reduce(
(acc, attribute) => [ (acc, attribute) => [
...acc, ...acc,
attribute.values.find( attribute.values?.find(
value => value =>
value.slug === value?.slug ===
variant.attributes.find( variant.attributes.find(
variantAttribute => variantAttribute.id === attribute.id variantAttribute => variantAttribute.id === attribute.id
).values[0] ).values[0]
).name )?.value?.name
], ],
[] []
); );
@ -132,7 +132,6 @@ function getVariantName(
const ProductVariantCreatorSummary: React.FC<ProductVariantCreatorSummaryProps> = props => { const ProductVariantCreatorSummary: React.FC<ProductVariantCreatorSummaryProps> = props => {
const { const {
attributes,
channelListings, channelListings,
data, data,
errors, errors,
@ -220,7 +219,7 @@ const ProductVariantCreatorSummary: React.FC<ProductVariantCreatorSummaryProps>
.join(":")} .join(":")}
> >
<div className={classNames(classes.col, classes.colName)}> <div className={classNames(classes.col, classes.colName)}>
{getVariantName(variant, attributes).map( {getVariantName(variant, data.attributes).map(
(value, valueIndex) => ( (value, valueIndex) => (
<span <span
className={classes.attributeValue} className={classes.attributeValue}

View file

@ -1,17 +1,30 @@
import { Card, CardContent } from "@material-ui/core"; import { Card, CardContent } from "@material-ui/core";
import Alert from "@saleor/components/Alert/Alert"; import Alert from "@saleor/components/Alert/Alert";
import { getMultiChoices } from "@saleor/components/Attributes/utils";
import CardSpacer from "@saleor/components/CardSpacer"; import CardSpacer from "@saleor/components/CardSpacer";
import CardTitle from "@saleor/components/CardTitle"; import CardTitle from "@saleor/components/CardTitle";
import ControlledCheckbox from "@saleor/components/ControlledCheckbox"; import MultiAutocompleteSelectField from "@saleor/components/MultiAutocompleteSelectField";
import Debounce from "@saleor/components/Debounce";
import Skeleton from "@saleor/components/Skeleton"; import Skeleton from "@saleor/components/Skeleton";
import { AttributeValueFragment } from "@saleor/fragments/types/AttributeValueFragment";
import { getById } from "@saleor/orders/components/OrderReturnPage/utils";
import { ProductDetails_product_productType_variantAttributes } from "@saleor/products/types/ProductDetails"; import { ProductDetails_product_productType_variantAttributes } from "@saleor/products/types/ProductDetails";
import { makeStyles } from "@saleor/theme"; import { SearchAttributeValues_attribute_choices_edges_node } from "@saleor/searches/types/SearchAttributeValues";
import { isSelected } from "@saleor/utils/lists"; import { FetchMoreProps } from "@saleor/types";
import React from "react"; import React from "react";
import { FormattedMessage, useIntl } from "react-intl"; import { defineMessages, FormattedMessage, useIntl } from "react-intl";
import { ProductVariantCreateFormData } from "./form"; import {
Attribute,
AttributeValue,
ProductVariantCreateFormData
} from "./form";
const messages = defineMessages({
multipleValueLabel: {
defaultMessage: "Values",
description: "attribute values"
}
});
export function getVariantsNumber(data: ProductVariantCreateFormData): number { export function getVariantsNumber(data: ProductVariantCreateFormData): number {
return data.attributes.reduce( return data.attributes.reduce(
@ -20,30 +33,64 @@ export function getVariantsNumber(data: ProductVariantCreateFormData): number {
); );
} }
export function getMultiValues(
attributes: Attribute[],
attribute: ProductDetails_product_productType_variantAttributes
) {
return attributes
.find(getById(attribute.id))
?.values?.map(value => value.slug);
}
export function getMultiDisplayValues(
attributes: Attribute[],
attribute: ProductDetails_product_productType_variantAttributes
) {
return attributes.find(getById(attribute.id))?.values.map(value => ({
label: value.value?.name,
value: value.slug
}));
}
export interface ProductVariantCreatorValuesProps { export interface ProductVariantCreatorValuesProps {
attributes: ProductDetails_product_productType_variantAttributes[]; attributes: ProductDetails_product_productType_variantAttributes[];
attributeValues: SearchAttributeValues_attribute_choices_edges_node[];
fetchAttributeValues: (query: string) => void;
fetchMoreAttributeValues?: FetchMoreProps;
data: ProductVariantCreateFormData; data: ProductVariantCreateFormData;
variantsLeft: number | null; variantsLeft: number | null;
onValueClick: (attributeId: string, valueId: string) => void; onValueClick: (
attributeId: string,
value: AttributeValue<AttributeValueFragment>
) => void;
onAttributeFocus: (id: string) => void;
} }
const useStyles = makeStyles(
theme => ({
valueContainer: {
display: "grid",
gridColumnGap: theme.spacing(3),
gridTemplateColumns: "repeat(5, 1fr)"
}
}),
{ name: "ProductVariantCreatorValues" }
);
const ProductVariantCreatorValues: React.FC<ProductVariantCreatorValuesProps> = props => { const ProductVariantCreatorValues: React.FC<ProductVariantCreatorValuesProps> = props => {
const { attributes, data, variantsLeft, onValueClick } = props; const {
const classes = useStyles(props); attributes,
attributeValues,
fetchAttributeValues,
fetchMoreAttributeValues,
data,
variantsLeft,
onValueClick,
onAttributeFocus
} = props;
const intl = useIntl(); const intl = useIntl();
const variantsNumber = getVariantsNumber(data); const variantsNumber = getVariantsNumber(data);
const handleValueClick = (attributeId: string, valueSlug: string) => {
const dataAttribute = data.attributes.find(getById(attributeId));
onValueClick(attributeId, {
slug: valueSlug,
value:
dataAttribute?.values.find(value => value.slug === valueSlug)?.value ||
attributeValues.find(value => value.slug === valueSlug)
});
};
return ( return (
<> <>
{variantsLeft !== null && ( {variantsLeft !== null && (
@ -67,32 +114,24 @@ const ProductVariantCreatorValues: React.FC<ProductVariantCreatorValuesProps> =
<React.Fragment key={attribute.id}> <React.Fragment key={attribute.id}>
<Card> <Card>
<CardTitle title={attribute?.name || <Skeleton />} /> <CardTitle title={attribute?.name || <Skeleton />} />
<CardContent <CardContent data-test-id="value-container">
className={classes.valueContainer} <MultiAutocompleteSelectField
data-test-id="value-container" choices={getMultiChoices(attributeValues)}
> displayValues={getMultiDisplayValues(
{attribute.values.map(value => ( data.attributes,
<Debounce attribute
debounceFn={() => onValueClick(attribute.id, value.slug)}
time={100}
key={value.slug}
>
{change => (
<ControlledCheckbox
checked={isSelected(
value.slug,
data.attributes.find(
dataAttribute => attribute.id === dataAttribute.id
)?.values || [],
(a, b) => a === b
)} )}
name={`value:${value.slug}`} name={`attribute:${attribute.name}`}
label={value.name} label={intl.formatMessage(messages.multipleValueLabel)}
onChange={change} value={getMultiValues(data.attributes, attribute)}
onChange={event =>
handleValueClick(attribute.id, event.target.value)
}
allowCustomValues={true}
fetchChoices={fetchAttributeValues}
{...fetchMoreAttributeValues}
onFocus={() => onAttributeFocus(attribute.id)}
/> />
)}
</Debounce>
))}
</CardContent> </CardContent>
</Card> </Card>
<CardSpacer /> <CardSpacer />

View file

@ -6,22 +6,88 @@ Object {
Object { Object {
"id": "attr-1", "id": "attr-1",
"values": Array [ "values": Array [
"val-1-1", Object {
"val-1-7", "slug": "val-1-1",
"value": Object {
"__typename": "AttributeValue",
"file": null,
"id": "val-1-1",
"name": "val-1-1",
"reference": null,
"richText": null,
"slug": "val-1-1",
},
},
Object {
"slug": "val-1-7",
"value": Object {
"__typename": "AttributeValue",
"file": null,
"id": "val-1-7",
"name": "val-1-7",
"reference": null,
"richText": null,
"slug": "val-1-7",
},
},
], ],
}, },
Object { Object {
"id": "attr-2", "id": "attr-2",
"values": Array [ "values": Array [
"val-2-2", Object {
"val-2-4", "slug": "val-2-2",
"value": Object {
"__typename": "AttributeValue",
"file": null,
"id": "val-2-2",
"name": "val-2-2",
"reference": null,
"richText": null,
"slug": "val-2-2",
},
},
Object {
"slug": "val-2-4",
"value": Object {
"__typename": "AttributeValue",
"file": null,
"id": "val-2-4",
"name": "val-2-4",
"reference": null,
"richText": null,
"slug": "val-2-4",
},
},
], ],
}, },
Object { Object {
"id": "attr-4", "id": "attr-4",
"values": Array [ "values": Array [
"val-4-1", Object {
"val-4-5", "slug": "val-4-1",
"value": Object {
"__typename": "AttributeValue",
"file": null,
"id": "val-4-1",
"name": "val-4-1",
"reference": null,
"richText": null,
"slug": "val-4-1",
},
},
Object {
"slug": "val-4-5",
"value": Object {
"__typename": "AttributeValue",
"file": null,
"id": "val-4-5",
"name": "val-4-5",
"reference": null,
"richText": null,
"slug": "val-4-5",
},
},
], ],
}, },
], ],
@ -561,22 +627,88 @@ Object {
Object { Object {
"id": "attr-1", "id": "attr-1",
"values": Array [ "values": Array [
"val-1-1", Object {
"val-1-7", "slug": "val-1-1",
"value": Object {
"__typename": "AttributeValue",
"file": null,
"id": "val-1-1",
"name": "val-1-1",
"reference": null,
"richText": null,
"slug": "val-1-1",
},
},
Object {
"slug": "val-1-7",
"value": Object {
"__typename": "AttributeValue",
"file": null,
"id": "val-1-7",
"name": "val-1-7",
"reference": null,
"richText": null,
"slug": "val-1-7",
},
},
], ],
}, },
Object { Object {
"id": "attr-2", "id": "attr-2",
"values": Array [ "values": Array [
"val-2-2", Object {
"val-2-4", "slug": "val-2-2",
"value": Object {
"__typename": "AttributeValue",
"file": null,
"id": "val-2-2",
"name": "val-2-2",
"reference": null,
"richText": null,
"slug": "val-2-2",
},
},
Object {
"slug": "val-2-4",
"value": Object {
"__typename": "AttributeValue",
"file": null,
"id": "val-2-4",
"name": "val-2-4",
"reference": null,
"richText": null,
"slug": "val-2-4",
},
},
], ],
}, },
Object { Object {
"id": "attr-4", "id": "attr-4",
"values": Array [ "values": Array [
"val-4-1", Object {
"val-4-5", "slug": "val-4-1",
"value": Object {
"__typename": "AttributeValue",
"file": null,
"id": "val-4-1",
"name": "val-4-1",
"reference": null,
"richText": null,
"slug": "val-4-1",
},
},
Object {
"slug": "val-4-5",
"value": Object {
"__typename": "AttributeValue",
"file": null,
"id": "val-4-5",
"name": "val-4-5",
"reference": null,
"richText": null,
"slug": "val-4-5",
},
},
], ],
}, },
], ],
@ -1116,22 +1248,88 @@ Object {
Object { Object {
"id": "attr-1", "id": "attr-1",
"values": Array [ "values": Array [
"val-1-1", Object {
"val-1-7", "slug": "val-1-1",
"value": Object {
"__typename": "AttributeValue",
"file": null,
"id": "val-1-1",
"name": "val-1-1",
"reference": null,
"richText": null,
"slug": "val-1-1",
},
},
Object {
"slug": "val-1-7",
"value": Object {
"__typename": "AttributeValue",
"file": null,
"id": "val-1-7",
"name": "val-1-7",
"reference": null,
"richText": null,
"slug": "val-1-7",
},
},
], ],
}, },
Object { Object {
"id": "attr-2", "id": "attr-2",
"values": Array [ "values": Array [
"val-2-2", Object {
"val-2-4", "slug": "val-2-2",
"value": Object {
"__typename": "AttributeValue",
"file": null,
"id": "val-2-2",
"name": "val-2-2",
"reference": null,
"richText": null,
"slug": "val-2-2",
},
},
Object {
"slug": "val-2-4",
"value": Object {
"__typename": "AttributeValue",
"file": null,
"id": "val-2-4",
"name": "val-2-4",
"reference": null,
"richText": null,
"slug": "val-2-4",
},
},
], ],
}, },
Object { Object {
"id": "attr-4", "id": "attr-4",
"values": Array [ "values": Array [
"val-4-1", Object {
"val-4-5", "slug": "val-4-1",
"value": Object {
"__typename": "AttributeValue",
"file": null,
"id": "val-4-1",
"name": "val-4-1",
"reference": null,
"richText": null,
"slug": "val-4-1",
},
},
Object {
"slug": "val-4-5",
"value": Object {
"__typename": "AttributeValue",
"file": null,
"id": "val-4-5",
"name": "val-4-5",
"reference": null,
"richText": null,
"slug": "val-4-5",
},
},
], ],
}, },
], ],
@ -1171,22 +1369,88 @@ Object {
Object { Object {
"id": "attr-1", "id": "attr-1",
"values": Array [ "values": Array [
"val-1-1", Object {
"val-1-7", "slug": "val-1-1",
"value": Object {
"__typename": "AttributeValue",
"file": null,
"id": "val-1-1",
"name": "val-1-1",
"reference": null,
"richText": null,
"slug": "val-1-1",
},
},
Object {
"slug": "val-1-7",
"value": Object {
"__typename": "AttributeValue",
"file": null,
"id": "val-1-7",
"name": "val-1-7",
"reference": null,
"richText": null,
"slug": "val-1-7",
},
},
], ],
}, },
Object { Object {
"id": "attr-2", "id": "attr-2",
"values": Array [ "values": Array [
"val-2-2", Object {
"val-2-4", "slug": "val-2-2",
"value": Object {
"__typename": "AttributeValue",
"file": null,
"id": "val-2-2",
"name": "val-2-2",
"reference": null,
"richText": null,
"slug": "val-2-2",
},
},
Object {
"slug": "val-2-4",
"value": Object {
"__typename": "AttributeValue",
"file": null,
"id": "val-2-4",
"name": "val-2-4",
"reference": null,
"richText": null,
"slug": "val-2-4",
},
},
], ],
}, },
Object { Object {
"id": "attr-4", "id": "attr-4",
"values": Array [ "values": Array [
"val-4-1", Object {
"val-4-5", "slug": "val-4-1",
"value": Object {
"__typename": "AttributeValue",
"file": null,
"id": "val-4-1",
"name": "val-4-1",
"reference": null,
"richText": null,
"slug": "val-4-1",
},
},
Object {
"slug": "val-4-5",
"value": Object {
"__typename": "AttributeValue",
"file": null,
"id": "val-4-5",
"name": "val-4-5",
"reference": null,
"richText": null,
"slug": "val-4-5",
},
},
], ],
}, },
], ],
@ -1677,22 +1941,88 @@ Object {
Object { Object {
"id": "attr-1", "id": "attr-1",
"values": Array [ "values": Array [
"val-1-1", Object {
"val-1-7", "slug": "val-1-1",
"value": Object {
"__typename": "AttributeValue",
"file": null,
"id": "val-1-1",
"name": "val-1-1",
"reference": null,
"richText": null,
"slug": "val-1-1",
},
},
Object {
"slug": "val-1-7",
"value": Object {
"__typename": "AttributeValue",
"file": null,
"id": "val-1-7",
"name": "val-1-7",
"reference": null,
"richText": null,
"slug": "val-1-7",
},
},
], ],
}, },
Object { Object {
"id": "attr-2", "id": "attr-2",
"values": Array [ "values": Array [
"val-2-2", Object {
"val-2-4", "slug": "val-2-2",
"value": Object {
"__typename": "AttributeValue",
"file": null,
"id": "val-2-2",
"name": "val-2-2",
"reference": null,
"richText": null,
"slug": "val-2-2",
},
},
Object {
"slug": "val-2-4",
"value": Object {
"__typename": "AttributeValue",
"file": null,
"id": "val-2-4",
"name": "val-2-4",
"reference": null,
"richText": null,
"slug": "val-2-4",
},
},
], ],
}, },
Object { Object {
"id": "attr-4", "id": "attr-4",
"values": Array [ "values": Array [
"val-4-1", Object {
"val-4-5", "slug": "val-4-1",
"value": Object {
"__typename": "AttributeValue",
"file": null,
"id": "val-4-1",
"name": "val-4-1",
"reference": null,
"richText": null,
"slug": "val-4-1",
},
},
Object {
"slug": "val-4-5",
"value": Object {
"__typename": "AttributeValue",
"file": null,
"id": "val-4-5",
"name": "val-4-5",
"reference": null,
"richText": null,
"slug": "val-4-5",
},
},
], ],
}, },
], ],
@ -2138,22 +2468,88 @@ Object {
Object { Object {
"id": "attr-1", "id": "attr-1",
"values": Array [ "values": Array [
"val-1-1", Object {
"val-1-7", "slug": "val-1-1",
"value": Object {
"__typename": "AttributeValue",
"file": null,
"id": "val-1-1",
"name": "val-1-1",
"reference": null,
"richText": null,
"slug": "val-1-1",
},
},
Object {
"slug": "val-1-7",
"value": Object {
"__typename": "AttributeValue",
"file": null,
"id": "val-1-7",
"name": "val-1-7",
"reference": null,
"richText": null,
"slug": "val-1-7",
},
},
], ],
}, },
Object { Object {
"id": "attr-2", "id": "attr-2",
"values": Array [ "values": Array [
"val-2-2", Object {
"val-2-4", "slug": "val-2-2",
"value": Object {
"__typename": "AttributeValue",
"file": null,
"id": "val-2-2",
"name": "val-2-2",
"reference": null,
"richText": null,
"slug": "val-2-2",
},
},
Object {
"slug": "val-2-4",
"value": Object {
"__typename": "AttributeValue",
"file": null,
"id": "val-2-4",
"name": "val-2-4",
"reference": null,
"richText": null,
"slug": "val-2-4",
},
},
], ],
}, },
Object { Object {
"id": "attr-4", "id": "attr-4",
"values": Array [ "values": Array [
"val-4-1", Object {
"val-4-5", "slug": "val-4-1",
"value": Object {
"__typename": "AttributeValue",
"file": null,
"id": "val-4-1",
"name": "val-4-1",
"reference": null,
"richText": null,
"slug": "val-4-1",
},
},
Object {
"slug": "val-4-5",
"value": Object {
"__typename": "AttributeValue",
"file": null,
"id": "val-4-5",
"name": "val-4-5",
"reference": null,
"richText": null,
"slug": "val-4-5",
},
},
], ],
}, },
], ],
@ -2644,22 +3040,88 @@ Object {
Object { Object {
"id": "attr-1", "id": "attr-1",
"values": Array [ "values": Array [
"val-1-1", Object {
"val-1-7", "slug": "val-1-1",
"value": Object {
"__typename": "AttributeValue",
"file": null,
"id": "val-1-1",
"name": "val-1-1",
"reference": null,
"richText": null,
"slug": "val-1-1",
},
},
Object {
"slug": "val-1-7",
"value": Object {
"__typename": "AttributeValue",
"file": null,
"id": "val-1-7",
"name": "val-1-7",
"reference": null,
"richText": null,
"slug": "val-1-7",
},
},
], ],
}, },
Object { Object {
"id": "attr-2", "id": "attr-2",
"values": Array [ "values": Array [
"val-2-2", Object {
"val-2-4", "slug": "val-2-2",
"value": Object {
"__typename": "AttributeValue",
"file": null,
"id": "val-2-2",
"name": "val-2-2",
"reference": null,
"richText": null,
"slug": "val-2-2",
},
},
Object {
"slug": "val-2-4",
"value": Object {
"__typename": "AttributeValue",
"file": null,
"id": "val-2-4",
"name": "val-2-4",
"reference": null,
"richText": null,
"slug": "val-2-4",
},
},
], ],
}, },
Object { Object {
"id": "attr-4", "id": "attr-4",
"values": Array [ "values": Array [
"val-4-1", Object {
"val-4-5", "slug": "val-4-1",
"value": Object {
"__typename": "AttributeValue",
"file": null,
"id": "val-4-1",
"name": "val-4-1",
"reference": null,
"richText": null,
"slug": "val-4-1",
},
},
Object {
"slug": "val-4-5",
"value": Object {
"__typename": "AttributeValue",
"file": null,
"id": "val-4-5",
"name": "val-4-5",
"reference": null,
"richText": null,
"slug": "val-4-5",
},
},
], ],
}, },
], ],
@ -3067,22 +3529,88 @@ Object {
Object { Object {
"id": "attr-1", "id": "attr-1",
"values": Array [ "values": Array [
"val-1-1", Object {
"val-1-7", "slug": "val-1-1",
"value": Object {
"__typename": "AttributeValue",
"file": null,
"id": "val-1-1",
"name": "val-1-1",
"reference": null,
"richText": null,
"slug": "val-1-1",
},
},
Object {
"slug": "val-1-7",
"value": Object {
"__typename": "AttributeValue",
"file": null,
"id": "val-1-7",
"name": "val-1-7",
"reference": null,
"richText": null,
"slug": "val-1-7",
},
},
], ],
}, },
Object { Object {
"id": "attr-2", "id": "attr-2",
"values": Array [ "values": Array [
"val-2-2", Object {
"val-2-4", "slug": "val-2-2",
"value": Object {
"__typename": "AttributeValue",
"file": null,
"id": "val-2-2",
"name": "val-2-2",
"reference": null,
"richText": null,
"slug": "val-2-2",
},
},
Object {
"slug": "val-2-4",
"value": Object {
"__typename": "AttributeValue",
"file": null,
"id": "val-2-4",
"name": "val-2-4",
"reference": null,
"richText": null,
"slug": "val-2-4",
},
},
], ],
}, },
Object { Object {
"id": "attr-4", "id": "attr-4",
"values": Array [ "values": Array [
"val-4-1", Object {
"val-4-5", "slug": "val-4-1",
"value": Object {
"__typename": "AttributeValue",
"file": null,
"id": "val-4-1",
"name": "val-4-1",
"reference": null,
"richText": null,
"slug": "val-4-1",
},
},
Object {
"slug": "val-4-5",
"value": Object {
"__typename": "AttributeValue",
"file": null,
"id": "val-4-5",
"name": "val-4-5",
"reference": null,
"richText": null,
"slug": "val-4-5",
},
},
], ],
}, },
], ],

View file

@ -63,7 +63,7 @@ describe("Creates variant matrix", () => {
attribute: attribute.id, attribute: attribute.id,
mode: "attribute", mode: "attribute",
values: attribute.values.map((attributeValue, index) => ({ values: attribute.values.map((attributeValue, index) => ({
slug: attributeValue, slug: attributeValue.slug,
value: channels.map(channel => ({ value: channels.map(channel => ({
channelId: channel.id, channelId: channel.id,
price: (channel.price + index).toString() price: (channel.price + index).toString()
@ -97,7 +97,7 @@ describe("Creates variant matrix", () => {
variant => variant =>
variant.attributes.find( variant.attributes.find(
variantAttribute => variantAttribute.id === attribute.id variantAttribute => variantAttribute.id === attribute.id
).values[0] === attributeValue ).values[0] === attributeValue.slug
) )
.forEach(variant => { .forEach(variant => {
variant.channelListings.map((channel, index) => { variant.channelListings.map((channel, index) => {
@ -128,7 +128,7 @@ describe("Creates variant matrix", () => {
attribute: attribute.id, attribute: attribute.id,
mode: "attribute", mode: "attribute",
values: attribute.values.map((attributeValue, attributeValueIndex) => ({ values: attribute.values.map((attributeValue, attributeValueIndex) => ({
slug: attributeValue, slug: attributeValue.slug,
value: stock.map( value: stock.map(
(_, stockIndex) => stock[stockIndex] * (attributeValueIndex + 1) (_, stockIndex) => stock[stockIndex] * (attributeValueIndex + 1)
) )
@ -154,7 +154,7 @@ describe("Creates variant matrix", () => {
variant => variant =>
variant.attributes.find( variant.attributes.find(
variantAttribute => variantAttribute.id === attribute.id variantAttribute => variantAttribute.id === attribute.id
).values[0] === attributeValue ).values[0] === attributeValue.slug
) )
.forEach(variant => { .forEach(variant => {
variant.stocks.forEach((_, stockIndex) => { variant.stocks.forEach((_, stockIndex) => {
@ -179,7 +179,7 @@ describe("Creates variant matrix", () => {
attribute: attribute.id, attribute: attribute.id,
mode: "attribute", mode: "attribute",
values: attribute.values.map((attributeValue, index) => ({ values: attribute.values.map((attributeValue, index) => ({
slug: attributeValue, slug: attributeValue.slug,
value: channels.map(channel => ({ value: channels.map(channel => ({
channelId: channel.id, channelId: channel.id,
price: (channel.price + index).toString() price: (channel.price + index).toString()
@ -191,7 +191,7 @@ describe("Creates variant matrix", () => {
attribute: attribute.id, attribute: attribute.id,
mode: "attribute", mode: "attribute",
values: attribute.values.map((attributeValue, attributeValueIndex) => ({ values: attribute.values.map((attributeValue, attributeValueIndex) => ({
slug: attributeValue, slug: attributeValue.slug,
value: stock.map( value: stock.map(
(_, stockIndex) => stock[stockIndex] * (attributeValueIndex + 1) (_, stockIndex) => stock[stockIndex] * (attributeValueIndex + 1)
) )
@ -213,7 +213,7 @@ describe("Creates variant matrix", () => {
variant => variant =>
variant.attributes.find( variant.attributes.find(
variantAttribute => variantAttribute.id === attribute.id variantAttribute => variantAttribute.id === attribute.id
).values[0] === attributeValue ).values[0] === attributeValue.slug
) )
.forEach(variant => { .forEach(variant => {
variant.channelListings.map((channel, index) => { variant.channelListings.map((channel, index) => {
@ -230,7 +230,7 @@ describe("Creates variant matrix", () => {
variant => variant =>
variant.attributes.find( variant.attributes.find(
variantAttribute => variantAttribute.id === attribute.id variantAttribute => variantAttribute.id === attribute.id
).values[0] === attributeValue ).values[0] === attributeValue.slug
) )
.forEach(variant => { .forEach(variant => {
variant.stocks.forEach((_, stockIndex) => { variant.stocks.forEach((_, stockIndex) => {

View file

@ -112,11 +112,11 @@ function addAttributeToVariant(
attribute: Attribute, attribute: Attribute,
variant: CreateVariantInput variant: CreateVariantInput
): CreateVariantInput[] { ): CreateVariantInput[] {
return attribute.values.map(attributeValueSlug => [ return attribute.values.map(attributeValue => [
...variant, ...variant,
{ {
attributeId: attribute.id, attributeId: attribute.id,
attributeValueSlug attributeValueSlug: attributeValue.slug
} }
]); ]);
} }

View file

@ -20,25 +20,69 @@ export const attributes = [
id: "attr-1", id: "attr-1",
values: Array(9) values: Array(9)
.fill(0) .fill(0)
.map((_, index) => `val-1-${index + 1}`) .map((_, index) => ({
slug: `val-1-${index + 1}`,
value: {
__typename: "AttributeValue" as "AttributeValue",
id: `val-1-${index + 1}`,
name: `val-1-${index + 1}`,
slug: `val-1-${index + 1}`,
file: null,
reference: null,
richText: null
}
}))
}, },
{ {
id: "attr-2", id: "attr-2",
values: Array(6) values: Array(6)
.fill(0) .fill(0)
.map((_, index) => `val-2-${index + 1}`) .map((_, index) => ({
slug: `val-2-${index + 1}`,
value: {
__typename: "AttributeValue" as "AttributeValue",
id: `val-2-${index + 1}`,
name: `val-2-${index + 1}`,
slug: `val-2-${index + 1}`,
file: null,
reference: null,
richText: null
}
}))
}, },
{ {
id: "attr-3", id: "attr-3",
values: Array(4) values: Array(4)
.fill(0) .fill(0)
.map((_, index) => `val-3-${index + 1}`) .map((_, index) => ({
slug: `val-3-${index + 1}`,
value: {
__typename: "AttributeValue" as "AttributeValue",
id: `val-3-${index + 1}`,
name: `val-3-${index + 1}`,
slug: `val-3-${index + 1}`,
file: null,
reference: null,
richText: null
}
}))
}, },
{ {
id: "attr-4", id: "attr-4",
values: Array(11) values: Array(11)
.fill(0) .fill(0)
.map((_, index) => `val-4-${index + 1}`) .map((_, index) => ({
slug: `val-4-${index + 1}`,
value: {
__typename: "AttributeValue" as "AttributeValue",
id: `val-4-${index + 1}`,
name: `val-4-${index + 1}`,
slug: `val-4-${index + 1}`,
file: null,
reference: null,
richText: null
}
}))
} }
]; ];
@ -116,7 +160,7 @@ const price: Price = {
mode: "attribute", mode: "attribute",
values: [ values: [
{ {
slug: thirdStep.attributes[1].values[0], slug: thirdStep.attributes[1].values[0].slug,
value: [ value: [
{ channelId: channels[0].id, price: "0" }, { channelId: channels[0].id, price: "0" },
{ channelId: channels[1].id, price: "2" }, { channelId: channels[1].id, price: "2" },
@ -124,7 +168,7 @@ const price: Price = {
] ]
}, },
{ {
slug: thirdStep.attributes[1].values[1], slug: thirdStep.attributes[1].values[1].slug,
value: [ value: [
{ channelId: channels[0].id, price: "0" }, { channelId: channels[0].id, price: "0" },
{ channelId: channels[1].id, price: "2" }, { channelId: channels[1].id, price: "2" },
@ -139,11 +183,11 @@ const stock: Stock = {
value: [], value: [],
values: [ values: [
{ {
slug: thirdStep.attributes[2].values[0], slug: thirdStep.attributes[2].values[0].slug,
value: [50, 20, 45, 75] value: [50, 20, 45, 75]
}, },
{ {
slug: thirdStep.attributes[2].values[1], slug: thirdStep.attributes[2].values[1].slug,
value: [80, 50, 85, 105] value: [80, 50, 85, 105]
} }
] ]

View file

@ -1,4 +1,5 @@
import { ChannelPriceData } from "@saleor/channels/utils"; import { ChannelPriceData } from "@saleor/channels/utils";
import { AttributeValueFragment } from "@saleor/fragments/types/AttributeValueFragment";
import { WarehouseFragment } from "@saleor/fragments/types/WarehouseFragment"; import { WarehouseFragment } from "@saleor/fragments/types/WarehouseFragment";
import { ProductDetails_product_productType_variantAttributes } from "@saleor/products/types/ProductDetails"; import { ProductDetails_product_productType_variantAttributes } from "@saleor/products/types/ProductDetails";
@ -28,7 +29,7 @@ export interface Stock {
} }
export interface Attribute { export interface Attribute {
id: string; id: string;
values: string[]; values: Array<AttributeValue<AttributeValueFragment>>;
} }
export interface ProductVariantCreateFormData { export interface ProductVariantCreateFormData {
attributes: Attribute[]; attributes: Attribute[];

View file

@ -23,14 +23,14 @@ describe("Reducer is able to", () => {
{ {
selectValue: { selectValue: {
attributeId: attributes[0].id, attributeId: attributes[0].id,
valueId: attributes[0].values[0] value: attributes[0].values[0]
}, },
type: ProductVariantCreateReducerActionType.selectValue type: ProductVariantCreateReducerActionType.selectValue
}, },
{ {
selectValue: { selectValue: {
attributeId: attributes[0].id, attributeId: attributes[0].id,
valueId: attributes[0].values[6] value: attributes[0].values[6]
}, },
type: ProductVariantCreateReducerActionType.selectValue type: ProductVariantCreateReducerActionType.selectValue
@ -38,28 +38,28 @@ describe("Reducer is able to", () => {
{ {
selectValue: { selectValue: {
attributeId: attributes[1].id, attributeId: attributes[1].id,
valueId: attributes[1].values[1] value: attributes[1].values[1]
}, },
type: ProductVariantCreateReducerActionType.selectValue type: ProductVariantCreateReducerActionType.selectValue
}, },
{ {
selectValue: { selectValue: {
attributeId: attributes[1].id, attributeId: attributes[1].id,
valueId: attributes[1].values[3] value: attributes[1].values[3]
}, },
type: ProductVariantCreateReducerActionType.selectValue type: ProductVariantCreateReducerActionType.selectValue
}, },
{ {
selectValue: { selectValue: {
attributeId: attributes[3].id, attributeId: attributes[3].id,
valueId: attributes[3].values[0] value: attributes[3].values[0]
}, },
type: ProductVariantCreateReducerActionType.selectValue type: ProductVariantCreateReducerActionType.selectValue
}, },
{ {
selectValue: { selectValue: {
attributeId: attributes[3].id, attributeId: attributes[3].id,
valueId: attributes[3].values[4] value: attributes[3].values[4]
}, },
type: ProductVariantCreateReducerActionType.selectValue type: ProductVariantCreateReducerActionType.selectValue
} }
@ -164,7 +164,7 @@ describe("Reducer is able to", () => {
changeAttributeValuePrice: { changeAttributeValuePrice: {
channelId: channels[0].id, channelId: channels[0].id,
price: value.toString(), price: value.toString(),
valueId: attribute.values[0] valueId: attribute.values[0].slug
}, },
type: ProductVariantCreateReducerActionType.changeAttributeValuePrice type: ProductVariantCreateReducerActionType.changeAttributeValuePrice
}, },
@ -172,7 +172,7 @@ describe("Reducer is able to", () => {
changeAttributeValuePrice: { changeAttributeValuePrice: {
channelId: channels[1].id, channelId: channels[1].id,
price: (value + 6).toString(), price: (value + 6).toString(),
valueId: attribute.values[1] valueId: attribute.values[1].slug
}, },
type: ProductVariantCreateReducerActionType.changeAttributeValuePrice type: ProductVariantCreateReducerActionType.changeAttributeValuePrice
}, },
@ -209,7 +209,7 @@ describe("Reducer is able to", () => {
{ {
changeAttributeValueStock: { changeAttributeValueStock: {
quantity, quantity,
valueId: attribute.values[0], valueId: attribute.values[0].slug,
warehouseIndex: 0 warehouseIndex: 0
}, },
type: ProductVariantCreateReducerActionType.changeAttributeValueStock type: ProductVariantCreateReducerActionType.changeAttributeValueStock
@ -217,7 +217,7 @@ describe("Reducer is able to", () => {
{ {
changeAttributeValueStock: { changeAttributeValueStock: {
quantity: quantity + 6, quantity: quantity + 6,
valueId: attribute.values[1], valueId: attribute.values[1].slug,
warehouseIndex: 0 warehouseIndex: 0
}, },
type: ProductVariantCreateReducerActionType.changeAttributeValueStock type: ProductVariantCreateReducerActionType.changeAttributeValueStock

View file

@ -1,3 +1,4 @@
import { AttributeValueFragment } from "@saleor/fragments/types/AttributeValueFragment";
import { StockInput } from "@saleor/types/globalTypes"; import { StockInput } from "@saleor/types/globalTypes";
import { import {
add, add,
@ -10,6 +11,7 @@ import {
import { createVariants } from "./createVariants"; import { createVariants } from "./createVariants";
import { import {
AttributeValue,
ProductVariantCreateFormData, ProductVariantCreateFormData,
VariantCreatorPricesAndSkuMode VariantCreatorPricesAndSkuMode
} from "./form"; } from "./form";
@ -72,19 +74,22 @@ export interface ProductVariantCreateReducerAction {
reload?: { reload?: {
data?: ProductVariantCreateFormData; data?: ProductVariantCreateFormData;
}; };
selectValue?: Record<"attributeId" | "valueId", string>; selectValue?: {
attributeId: string;
value: AttributeValue<AttributeValueFragment>;
};
type: ProductVariantCreateReducerActionType; type: ProductVariantCreateReducerActionType;
} }
function selectValue( function selectValue(
prevState: ProductVariantCreateFormData, prevState: ProductVariantCreateFormData,
attributeId: string, attributeId: string,
valueSlug: string value: AttributeValue<AttributeValueFragment>
): ProductVariantCreateFormData { ): ProductVariantCreateFormData {
const attribute = prevState.attributes.find( const attribute = prevState.attributes.find(
attribute => attribute.id === attributeId attribute => attribute.id === attributeId
); );
const values = toggle(valueSlug, attribute.values, (a, b) => a === b); const values = toggle(value, attribute.values, (a, b) => a.slug === b.slug);
const updatedAttributes = add( const updatedAttributes = add(
{ {
id: attributeId, id: attributeId,
@ -97,7 +102,7 @@ function selectValue(
prevState.price.attribute === attributeId prevState.price.attribute === attributeId
? toggle( ? toggle(
{ {
slug: valueSlug, slug: value.slug,
value: [] value: []
}, },
prevState.price.values, prevState.price.values,
@ -109,7 +114,7 @@ function selectValue(
prevState.stock.attribute === attributeId prevState.stock.attribute === attributeId
? toggle( ? toggle(
{ {
slug: valueSlug, slug: value.slug,
value: [] value: []
}, },
prevState.stock.values, prevState.stock.values,
@ -237,8 +242,8 @@ function changeApplyPriceToAttributeId(
const attribute = state.attributes.find( const attribute = state.attributes.find(
attribute => attribute.id === attributeId attribute => attribute.id === attributeId
); );
const values = attribute.values.map(slug => ({ const values = attribute.values.map(value => ({
slug, slug: value.slug,
value: [] value: []
})); }));
@ -259,8 +264,8 @@ function changeApplyStockToAttributeId(
const attribute = state.attributes.find( const attribute = state.attributes.find(
attribute => attribute.id === attributeId attribute => attribute.id === attributeId
); );
const values = attribute.values.map(slug => ({ const values = attribute.values.map(value => ({
slug, slug: value.slug,
value: [] value: []
})); }));
@ -435,7 +440,7 @@ function reduceProductVariantCreateFormData(
return selectValue( return selectValue(
prevState, prevState,
action.selectValue.attributeId, action.selectValue.attributeId,
action.selectValue.valueId action.selectValue.value
); );
case ProductVariantCreateReducerActionType.applyPriceToAll: case ProductVariantCreateReducerActionType.applyPriceToAll:
return applyPriceToAll(prevState, action.applyPriceOrStockToAll.mode); return applyPriceToAll(prevState, action.applyPriceOrStockToAll.mode);

View file

@ -1,6 +1,6 @@
import { import {
ProductDetails_product_productType_variantAttributes, ProductDetails_product_productType_variantAttributes,
ProductDetails_product_productType_variantAttributes_values ProductDetails_product_productType_variantAttributes_choices_edges_node
} from "@saleor/products/types/ProductDetails"; } from "@saleor/products/types/ProductDetails";
import { ProductVariantCreateFormData } from "./form"; import { ProductVariantCreateFormData } from "./form";
@ -8,33 +8,39 @@ import { ProductVariantCreateFormData } from "./form";
export function getPriceAttributeValues( export function getPriceAttributeValues(
data: ProductVariantCreateFormData, data: ProductVariantCreateFormData,
attributes: ProductDetails_product_productType_variantAttributes[] attributes: ProductDetails_product_productType_variantAttributes[]
): ProductDetails_product_productType_variantAttributes_values[] { ): ProductDetails_product_productType_variantAttributes_choices_edges_node[] {
return data.price.mode === "all" return data.price.mode === "all"
? null ? null
: data.price.attribute : data.price.attribute
? attributes ? attributes
.find(attribute => attribute.id === data.price.attribute) .find(attribute => attribute.id === data.price.attribute)
.values.filter(value => .choices.edges.filter(value =>
data.attributes data.attributes
.find(attribute => attribute.id === data.price.attribute) .find(attribute => attribute.id === data.price.attribute)
.values.includes(value.slug) .values.some(
attributeValue => attributeValue.slug === value.node.slug
) )
)
.map(value => value.node)
: []; : [];
} }
export function getStockAttributeValues( export function getStockAttributeValues(
data: ProductVariantCreateFormData, data: ProductVariantCreateFormData,
attributes: ProductDetails_product_productType_variantAttributes[] attributes: ProductDetails_product_productType_variantAttributes[]
): ProductDetails_product_productType_variantAttributes_values[] { ): ProductDetails_product_productType_variantAttributes_choices_edges_node[] {
return data.stock.mode === "all" return data.stock.mode === "all"
? null ? null
: data.stock.attribute : data.stock.attribute
? attributes ? attributes
.find(attribute => attribute.id === data.stock.attribute) .find(attribute => attribute.id === data.stock.attribute)
.values.filter(value => .choices.edges.filter(value =>
data.attributes data.attributes
.find(attribute => attribute.id === data.stock.attribute) .find(attribute => attribute.id === data.stock.attribute)
.values.includes(value.slug) .values.some(
attributeValue => attributeValue.slug === value.node.slug
) )
)
.map(value => value.node)
: []; : [];
} }

View file

@ -22,6 +22,7 @@ import { ProductErrorWithAttributesFragment } from "@saleor/fragments/types/Prod
import { ProductVariant } from "@saleor/fragments/types/ProductVariant"; import { ProductVariant } from "@saleor/fragments/types/ProductVariant";
import { WarehouseFragment } from "@saleor/fragments/types/WarehouseFragment"; import { WarehouseFragment } from "@saleor/fragments/types/WarehouseFragment";
import { VariantUpdate_productVariantUpdate_errors } from "@saleor/products/types/VariantUpdate"; import { VariantUpdate_productVariantUpdate_errors } from "@saleor/products/types/VariantUpdate";
import { SearchAttributeValues_attribute_choices_edges_node } from "@saleor/searches/types/SearchAttributeValues";
import { SearchPages_search_edges_node } from "@saleor/searches/types/SearchPages"; import { SearchPages_search_edges_node } from "@saleor/searches/types/SearchPages";
import { SearchProducts_search_edges_node } from "@saleor/searches/types/SearchProducts"; import { SearchProducts_search_edges_node } from "@saleor/searches/types/SearchProducts";
import { FetchMoreProps, ReorderAction } from "@saleor/types"; import { FetchMoreProps, ReorderAction } from "@saleor/types";
@ -87,11 +88,15 @@ interface ProductVariantPageProps {
warehouses: WarehouseFragment[]; warehouses: WarehouseFragment[];
referencePages?: SearchPages_search_edges_node[]; referencePages?: SearchPages_search_edges_node[];
referenceProducts?: SearchProducts_search_edges_node[]; referenceProducts?: SearchProducts_search_edges_node[];
attributeValues: SearchAttributeValues_attribute_choices_edges_node[];
fetchMoreReferencePages?: FetchMoreProps; fetchMoreReferencePages?: FetchMoreProps;
fetchMoreReferenceProducts?: FetchMoreProps; fetchMoreReferenceProducts?: FetchMoreProps;
fetchMoreAttributeValues?: FetchMoreProps;
fetchReferencePages?: (data: string) => void; fetchReferencePages?: (data: string) => void;
fetchReferenceProducts?: (data: string) => void; fetchReferenceProducts?: (data: string) => void;
fetchAttributeValues: (query: string) => void;
onAssignReferencesClick: (attribute: AttributeInput) => void; onAssignReferencesClick: (attribute: AttributeInput) => void;
onAttributeFocus: (id: string) => void;
onCloseDialog: () => void; onCloseDialog: () => void;
onVariantReorder: ReorderAction; onVariantReorder: ReorderAction;
onAdd(); onAdd();
@ -118,6 +123,7 @@ const ProductVariantPage: React.FC<ProductVariantPageProps> = ({
warehouses, warehouses,
referencePages = [], referencePages = [],
referenceProducts = [], referenceProducts = [],
attributeValues,
onAdd, onAdd,
onBack, onBack,
onDelete, onDelete,
@ -127,12 +133,15 @@ const ProductVariantPage: React.FC<ProductVariantPageProps> = ({
onVariantReorder, onVariantReorder,
onSetDefaultVariant, onSetDefaultVariant,
onWarehouseConfigure, onWarehouseConfigure,
onAttributeFocus,
assignReferencesAttributeId, assignReferencesAttributeId,
onAssignReferencesClick, onAssignReferencesClick,
fetchReferencePages, fetchReferencePages,
fetchReferenceProducts, fetchReferenceProducts,
fetchAttributeValues,
fetchMoreReferencePages, fetchMoreReferencePages,
fetchMoreReferenceProducts, fetchMoreReferenceProducts,
fetchMoreAttributeValues,
onCloseDialog onCloseDialog
}) => { }) => {
const intl = useIntl(); const intl = useIntl();
@ -226,6 +235,7 @@ const ProductVariantPage: React.FC<ProductVariantPageProps> = ({
attribute.data.variantAttributeScope === attribute.data.variantAttributeScope ===
VariantAttributeScope.NOT_VARIANT_SELECTION VariantAttributeScope.NOT_VARIANT_SELECTION
)} )}
attributeValues={attributeValues}
loading={loading} loading={loading}
disabled={loading} disabled={loading}
errors={errors} errors={errors}
@ -235,6 +245,9 @@ const ProductVariantPage: React.FC<ProductVariantPageProps> = ({
onReferencesRemove={handlers.selectAttributeReference} onReferencesRemove={handlers.selectAttributeReference}
onReferencesAddClick={onAssignReferencesClick} onReferencesAddClick={onAssignReferencesClick}
onReferencesReorder={handlers.reorderAttributeValue} onReferencesReorder={handlers.reorderAttributeValue}
fetchAttributeValues={fetchAttributeValues}
fetchMoreAttributeValues={fetchMoreAttributeValues}
onAttributeFocus={onAttributeFocus}
/> />
<CardSpacer /> <CardSpacer />
<Attributes <Attributes
@ -246,6 +259,7 @@ const ProductVariantPage: React.FC<ProductVariantPageProps> = ({
attribute.data.variantAttributeScope === attribute.data.variantAttributeScope ===
VariantAttributeScope.VARIANT_SELECTION VariantAttributeScope.VARIANT_SELECTION
)} )}
attributeValues={attributeValues}
loading={loading} loading={loading}
disabled={loading} disabled={loading}
errors={errors} errors={errors}
@ -255,6 +269,9 @@ const ProductVariantPage: React.FC<ProductVariantPageProps> = ({
onReferencesRemove={handlers.selectAttributeReference} onReferencesRemove={handlers.selectAttributeReference}
onReferencesAddClick={onAssignReferencesClick} onReferencesAddClick={onAssignReferencesClick}
onReferencesReorder={handlers.reorderAttributeValue} onReferencesReorder={handlers.reorderAttributeValue}
fetchAttributeValues={fetchAttributeValues}
fetchMoreAttributeValues={fetchMoreAttributeValues}
onAttributeFocus={onAttributeFocus}
/> />
<CardSpacer /> <CardSpacer />
<ProductVariantMedia <ProductVariantMedia

View file

@ -30,8 +30,20 @@ export const product: (
slug: "Borders", slug: "Borders",
valueRequired: false, valueRequired: false,
unit: null, unit: null,
values: [ choices: {
__typename: "AttributeValueCountableConnection",
pageInfo: {
endCursor: "WyI4IiwgIjMiXQ==",
hasNextPage: false,
hasPreviousPage: false,
startCursor: "WyIwIiwgIjQ5Il0=",
__typename: "PageInfo"
},
edges: [
{ {
__typename: "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue", __typename: "AttributeValue",
file: null, file: null,
id: "ptav47282", id: "ptav47282",
@ -39,8 +51,12 @@ export const product: (
reference: null, reference: null,
slug: "portals", slug: "portals",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue", __typename: "AttributeValue",
file: null, file: null,
id: "ptav17253", id: "ptav17253",
@ -49,7 +65,9 @@ export const product: (
slug: "Baht", slug: "Baht",
richText: null richText: null
} }
}
] ]
}
}, },
values: [ values: [
{ {
@ -74,8 +92,20 @@ export const product: (
slug: "Legacy", slug: "Legacy",
valueRequired: true, valueRequired: true,
unit: null, unit: null,
values: [ choices: {
__typename: "AttributeValueCountableConnection",
pageInfo: {
endCursor: "WyI4IiwgIjMiXQ==",
hasNextPage: false,
hasPreviousPage: false,
startCursor: "WyIwIiwgIjQ5Il0=",
__typename: "PageInfo"
},
edges: [
{ {
__typename: "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue", __typename: "AttributeValue",
file: null, file: null,
id: "ptav31282", id: "ptav31282",
@ -83,8 +113,12 @@ export const product: (
reference: null, reference: null,
slug: "payment", slug: "payment",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue", __typename: "AttributeValue",
file: null, file: null,
id: "ptav14907", id: "ptav14907",
@ -92,8 +126,12 @@ export const product: (
reference: null, reference: null,
slug: "Auto-Loan-Account", slug: "Auto-Loan-Account",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue", __typename: "AttributeValue",
file: null, file: null,
id: "ptav27366", id: "ptav27366",
@ -101,8 +139,12 @@ export const product: (
reference: null, reference: null,
slug: "Garden", slug: "Garden",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue", __typename: "AttributeValue",
file: null, file: null,
id: "ptav11873", id: "ptav11873",
@ -111,7 +153,9 @@ export const product: (
slug: "override", slug: "override",
richText: null richText: null
} }
}
] ]
}
}, },
values: [ values: [
{ {
@ -292,8 +336,20 @@ export const product: (
slug: "attachment", slug: "attachment",
valueRequired: true, valueRequired: true,
unit: null, unit: null,
values: [ choices: {
__typename: "AttributeValueCountableConnection",
pageInfo: {
endCursor: "WyI4IiwgIjMiXQ==",
hasNextPage: false,
hasPreviousPage: false,
startCursor: "WyIwIiwgIjQ5Il0=",
__typename: "PageInfo"
},
edges: [
{ {
__typename: "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue", __typename: "AttributeValue",
file: { file: {
__typename: "File", __typename: "File",
@ -306,8 +362,10 @@ export const product: (
slug: "file-first-value", slug: "file-first-value",
richText: null richText: null
} }
}
] ]
} }
}
], ],
selectionVariantAttributes: [ selectionVariantAttributes: [
{ {
@ -319,8 +377,20 @@ export const product: (
slug: "color", slug: "color",
valueRequired: true, valueRequired: true,
unit: null, unit: null,
values: [ choices: {
__typename: "AttributeValueCountableConnection",
pageInfo: {
endCursor: "WyI4IiwgIjMiXQ==",
hasNextPage: false,
hasPreviousPage: false,
startCursor: "WyIwIiwgIjQ5Il0=",
__typename: "PageInfo"
},
edges: [
{ {
__typename: "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue", __typename: "AttributeValue",
file: null, file: null,
id: "ptvav47282", id: "ptvav47282",
@ -328,8 +398,12 @@ export const product: (
reference: null, reference: null,
slug: "black", slug: "black",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue", __typename: "AttributeValue",
file: null, file: null,
id: "ptvav17253", id: "ptvav17253",
@ -338,8 +412,10 @@ export const product: (
slug: "white", slug: "white",
richText: null richText: null
} }
}
] ]
} }
}
], ],
taxType: { taxType: {
__typename: "TaxType", __typename: "TaxType",
@ -350,12 +426,21 @@ export const product: (
{ {
__typename: "Attribute", __typename: "Attribute",
id: "isdugfhud", id: "isdugfhud",
inputType: AttributeInputTypeEnum.FILE,
name: "Attachment", name: "Attachment",
slug: "attachment", choices: {
valueRequired: true, __typename: "AttributeValueCountableConnection",
values: [ pageInfo: {
endCursor: "WyI4IiwgIjMiXQ==",
hasNextPage: false,
hasPreviousPage: false,
startCursor: "WyIwIiwgIjQ5Il0=",
__typename: "PageInfo"
},
edges: [
{ {
__typename: "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue", __typename: "AttributeValue",
file: { file: {
__typename: "File", __typename: "File",
@ -368,17 +453,28 @@ export const product: (
slug: "file-first-value", slug: "file-first-value",
richText: null richText: null
} }
}
] ]
}
}, },
{ {
__typename: "Attribute", __typename: "Attribute",
id: "pta18161", id: "pta18161",
inputType: AttributeInputTypeEnum.DROPDOWN,
name: "Color", name: "Color",
slug: "color", choices: {
valueRequired: true, __typename: "AttributeValueCountableConnection",
values: [ pageInfo: {
endCursor: "WyI4IiwgIjMiXQ==",
hasNextPage: false,
hasPreviousPage: false,
startCursor: "WyIwIiwgIjQ5Il0=",
__typename: "PageInfo"
},
edges: [
{ {
__typename: "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue", __typename: "AttributeValue",
file: null, file: null,
id: "ptvav47282", id: "ptvav47282",
@ -386,8 +482,12 @@ export const product: (
reference: null, reference: null,
slug: "black", slug: "black",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue", __typename: "AttributeValue",
file: null, file: null,
id: "ptvav17253", id: "ptvav17253",
@ -396,8 +496,10 @@ export const product: (
slug: "white", slug: "white",
richText: null richText: null
} }
}
] ]
} }
}
] ]
}, },
publicationDate: "2018-08-25T18:45:54.125Z", publicationDate: "2018-08-25T18:45:54.125Z",
@ -2783,8 +2885,20 @@ export const variant = (placeholderImage: string): ProductVariant => ({
slug: "attachment", slug: "attachment",
valueRequired: true, valueRequired: true,
unit: null, unit: null,
values: [ choices: {
__typename: "AttributeValueCountableConnection",
pageInfo: {
endCursor: "WyI4IiwgIjMiXQ==",
hasNextPage: false,
hasPreviousPage: false,
startCursor: "WyIwIiwgIjQ5Il0=",
__typename: "PageInfo"
},
edges: [
{ {
__typename: "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue", __typename: "AttributeValue",
file: { file: {
__typename: "File", __typename: "File",
@ -2797,7 +2911,9 @@ export const variant = (placeholderImage: string): ProductVariant => ({
slug: "file-first-value", slug: "file-first-value",
richText: null richText: null
} }
}
] ]
}
}, },
values: [ values: [
{ {
@ -3052,8 +3168,20 @@ export const variant = (placeholderImage: string): ProductVariant => ({
slug: "Borders", slug: "Borders",
valueRequired: true, valueRequired: true,
unit: null, unit: null,
values: [ choices: {
__typename: "AttributeValueCountableConnection",
pageInfo: {
endCursor: "WyI4IiwgIjMiXQ==",
hasNextPage: false,
hasPreviousPage: false,
startCursor: "WyIwIiwgIjQ5Il0=",
__typename: "PageInfo"
},
edges: [
{ {
__typename: "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue", __typename: "AttributeValue",
file: null, file: null,
id: "ptav47282", id: "ptav47282",
@ -3061,8 +3189,12 @@ export const variant = (placeholderImage: string): ProductVariant => ({
reference: null, reference: null,
slug: "portals", slug: "portals",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue", __typename: "AttributeValue",
file: null, file: null,
id: "ptav17253", id: "ptav17253",
@ -3071,7 +3203,9 @@ export const variant = (placeholderImage: string): ProductVariant => ({
slug: "Baht", slug: "Baht",
richText: null richText: null
} }
}
] ]
}
}, },
values: [ values: [
{ {
@ -3096,8 +3230,20 @@ export const variant = (placeholderImage: string): ProductVariant => ({
slug: "Legacy", slug: "Legacy",
valueRequired: true, valueRequired: true,
unit: null, unit: null,
values: [ choices: {
__typename: "AttributeValueCountableConnection",
pageInfo: {
endCursor: "WyI4IiwgIjMiXQ==",
hasNextPage: false,
hasPreviousPage: false,
startCursor: "WyIwIiwgIjQ5Il0=",
__typename: "PageInfo"
},
edges: [
{ {
__typename: "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue", __typename: "AttributeValue",
file: null, file: null,
id: "ptav31282", id: "ptav31282",
@ -3105,8 +3251,12 @@ export const variant = (placeholderImage: string): ProductVariant => ({
reference: null, reference: null,
slug: "payment", slug: "payment",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue", __typename: "AttributeValue",
file: null, file: null,
id: "ptav14907", id: "ptav14907",
@ -3114,8 +3264,12 @@ export const variant = (placeholderImage: string): ProductVariant => ({
reference: null, reference: null,
slug: "Auto-Loan-Account", slug: "Auto-Loan-Account",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue", __typename: "AttributeValue",
file: null, file: null,
id: "ptav27366", id: "ptav27366",
@ -3123,8 +3277,12 @@ export const variant = (placeholderImage: string): ProductVariant => ({
reference: null, reference: null,
slug: "Garden", slug: "Garden",
richText: null richText: null
}
}, },
{ {
__typename: "AttributeValueCountableEdge",
cursor: "",
node: {
__typename: "AttributeValue", __typename: "AttributeValue",
file: null, file: null,
id: "ptav11873", id: "ptav11873",
@ -3133,7 +3291,9 @@ export const variant = (placeholderImage: string): ProductVariant => ({
slug: "override", slug: "override",
richText: null richText: null
} }
}
] ]
}
}, },
values: [ values: [
{ {

View file

@ -8,7 +8,10 @@ import {
stockErrorFragment stockErrorFragment
} from "@saleor/fragments/errors"; } from "@saleor/fragments/errors";
import { import {
channelListingProductFragment,
channelListingProductVariantFragment,
exportFileFragment, exportFileFragment,
fragmentProductMedia,
fragmentVariant, fragmentVariant,
productFragmentDetails productFragmentDetails
} from "@saleor/fragments/products"; } from "@saleor/fragments/products";
@ -81,7 +84,7 @@ import { VariantUpdate, VariantUpdateVariables } from "./types/VariantUpdate";
export const productMediaCreateMutation = gql` export const productMediaCreateMutation = gql`
${productErrorFragment} ${productErrorFragment}
${productFragmentDetails} ${fragmentProductMedia}
mutation ProductMediaCreate( mutation ProductMediaCreate(
$product: ID! $product: ID!
$image: Upload $image: Upload
@ -100,7 +103,10 @@ export const productMediaCreateMutation = gql`
...ProductErrorFragment ...ProductErrorFragment
} }
product { product {
...Product id
media {
...ProductMediaFragment
}
} }
} }
} }
@ -154,14 +160,21 @@ export const useProductMediaReorder = makeMutation<
const productVariantSetDefault = gql` const productVariantSetDefault = gql`
${productErrorFragment} ${productErrorFragment}
${productFragmentDetails}
mutation ProductVariantSetDefault($productId: ID!, $variantId: ID!) { mutation ProductVariantSetDefault($productId: ID!, $variantId: ID!) {
productVariantSetDefault(productId: $productId, variantId: $variantId) { productVariantSetDefault(productId: $productId, variantId: $variantId) {
errors { errors {
...ProductErrorFragment ...ProductErrorFragment
} }
product { product {
...Product id
defaultVariant {
id
name
}
variants {
id
name
}
} }
} }
} }
@ -175,7 +188,14 @@ export const useProductVariantSetDefaultMutation = makeMutation<
export const productUpdateMutation = gql` export const productUpdateMutation = gql`
${productErrorWithAttributesFragment} ${productErrorWithAttributesFragment}
${productFragmentDetails} ${productFragmentDetails}
mutation ProductUpdate($id: ID!, $input: ProductInput!) { mutation ProductUpdate(
$id: ID!
$input: ProductInput!
$firstValues: Int
$afterValues: String
$lastValues: Int
$beforeValues: String
) {
productUpdate(id: $id, input: $input) { productUpdate(id: $id, input: $input) {
errors { errors {
...ProductErrorWithAttributesFragment ...ProductErrorWithAttributesFragment
@ -205,6 +225,10 @@ export const simpleProductUpdateMutation = gql`
$addStocks: [StockInput!]! $addStocks: [StockInput!]!
$deleteStocks: [ID!]! $deleteStocks: [ID!]!
$updateStocks: [StockInput!]! $updateStocks: [StockInput!]!
$firstValues: Int
$afterValues: String
$lastValues: Int
$beforeValues: String
) { ) {
productUpdate(id: $id, input: $input) { productUpdate(id: $id, input: $input) {
errors { errors {
@ -264,14 +288,13 @@ export const useSimpleProductUpdateMutation = makeMutation<
export const productCreateMutation = gql` export const productCreateMutation = gql`
${productErrorWithAttributesFragment} ${productErrorWithAttributesFragment}
${productFragmentDetails}
mutation ProductCreate($input: ProductCreateInput!) { mutation ProductCreate($input: ProductCreateInput!) {
productCreate(input: $input) { productCreate(input: $input) {
errors { errors {
...ProductErrorWithAttributesFragment ...ProductErrorWithAttributesFragment
} }
product { product {
...Product id
} }
} }
} }
@ -312,6 +335,10 @@ export const variantUpdateMutation = gql`
$trackInventory: Boolean! $trackInventory: Boolean!
$stocks: [StockInput!]! $stocks: [StockInput!]!
$weight: WeightScalar $weight: WeightScalar
$firstValues: Int
$afterValues: String
$lastValues: Int
$beforeValues: String
) { ) {
productVariantUpdate( productVariantUpdate(
id: $id id: $id
@ -370,7 +397,13 @@ export const useVariantUpdateMutation = makeMutation<
export const variantCreateMutation = gql` export const variantCreateMutation = gql`
${fragmentVariant} ${fragmentVariant}
${productErrorWithAttributesFragment} ${productErrorWithAttributesFragment}
mutation VariantCreate($input: ProductVariantCreateInput!) { mutation VariantCreate(
$input: ProductVariantCreateInput!
$firstValues: Int
$afterValues: String
$lastValues: Int
$beforeValues: String
) {
productVariantCreate(input: $input) { productVariantCreate(input: $input) {
errors { errors {
...ProductErrorWithAttributesFragment ...ProductErrorWithAttributesFragment
@ -409,14 +442,17 @@ export const useProductMediaDeleteMutation = makeMutation<
export const productMediaUpdateMutation = gql` export const productMediaUpdateMutation = gql`
${productErrorFragment} ${productErrorFragment}
${productFragmentDetails} ${fragmentProductMedia}
mutation ProductMediaUpdate($id: ID!, $alt: String!) { mutation ProductMediaUpdate($id: ID!, $alt: String!) {
productMediaUpdate(id: $id, input: { alt: $alt }) { productMediaUpdate(id: $id, input: { alt: $alt }) {
errors { errors {
...ProductErrorFragment ...ProductErrorFragment
} }
product { product {
...Product id
media {
...ProductMediaFragment
}
} }
} }
} }
@ -427,7 +463,7 @@ export const useProductMediaUpdateMutation = makeMutation<
>(productMediaUpdateMutation); >(productMediaUpdateMutation);
export const variantMediaAssignMutation = gql` export const variantMediaAssignMutation = gql`
${fragmentVariant} ${fragmentProductMedia}
${productErrorFragment} ${productErrorFragment}
mutation VariantMediaAssign($variantId: ID!, $mediaId: ID!) { mutation VariantMediaAssign($variantId: ID!, $mediaId: ID!) {
variantMediaAssign(variantId: $variantId, mediaId: $mediaId) { variantMediaAssign(variantId: $variantId, mediaId: $mediaId) {
@ -435,7 +471,24 @@ export const variantMediaAssignMutation = gql`
...ProductErrorFragment ...ProductErrorFragment
} }
productVariant { productVariant {
...ProductVariant id
media {
...ProductMediaFragment
}
product {
id
media {
...ProductMediaFragment
}
variants {
id
name
sku
media {
...ProductMediaFragment
}
}
}
} }
} }
} }
@ -446,7 +499,7 @@ export const useVariantMediaAssignMutation = makeMutation<
>(variantMediaAssignMutation); >(variantMediaAssignMutation);
export const variantMediaUnassignMutation = gql` export const variantMediaUnassignMutation = gql`
${fragmentVariant} ${fragmentProductMedia}
${productErrorFragment} ${productErrorFragment}
mutation VariantMediaUnassign($variantId: ID!, $mediaId: ID!) { mutation VariantMediaUnassign($variantId: ID!, $mediaId: ID!) {
variantMediaUnassign(variantId: $variantId, mediaId: $mediaId) { variantMediaUnassign(variantId: $variantId, mediaId: $mediaId) {
@ -454,7 +507,24 @@ export const variantMediaUnassignMutation = gql`
...ProductErrorFragment ...ProductErrorFragment
} }
productVariant { productVariant {
...ProductVariant id
media {
...ProductMediaFragment
}
product {
id
media {
...ProductMediaFragment
}
variants {
id
name
sku
media {
...ProductMediaFragment
}
}
}
} }
} }
} }
@ -532,7 +602,8 @@ export const useProductExport = makeMutation<
>(productExportMutation); >(productExportMutation);
export const ProductChannelListingUpdateMutation = gql` export const ProductChannelListingUpdateMutation = gql`
${productFragmentDetails} ${channelListingProductFragment}
${channelListingProductVariantFragment}
${productChannelListingErrorFragment} ${productChannelListingErrorFragment}
mutation ProductChannelListingUpdate( mutation ProductChannelListingUpdate(
$id: ID! $id: ID!
@ -540,7 +611,16 @@ export const ProductChannelListingUpdateMutation = gql`
) { ) {
productChannelListingUpdate(id: $id, input: $input) { productChannelListingUpdate(id: $id, input: $input) {
product { product {
...Product id
channelListings {
...ChannelListingProductFragment
}
variants {
id
channelListings {
...ChannelListingProductVariantFragment
}
}
} }
errors { errors {
...ProductChannelListingErrorFragment ...ProductChannelListingErrorFragment
@ -551,14 +631,16 @@ export const ProductChannelListingUpdateMutation = gql`
const productVariantReorder = gql` const productVariantReorder = gql`
${productErrorFragment} ${productErrorFragment}
${productFragmentDetails}
mutation ProductVariantReorder($move: ReorderInput!, $productId: ID!) { mutation ProductVariantReorder($move: ReorderInput!, $productId: ID!) {
productVariantReorder(moves: [$move], productId: $productId) { productVariantReorder(moves: [$move], productId: $productId) {
errors { errors {
...ProductErrorFragment ...ProductErrorFragment
} }
product { product {
...Product id
variants {
id
}
} }
} }
} }
@ -573,7 +655,8 @@ export const useProductChannelListingUpdate = makeMutation<
>(ProductChannelListingUpdateMutation); >(ProductChannelListingUpdateMutation);
export const ProductVariantChannelListingUpdateMutation = gql` export const ProductVariantChannelListingUpdateMutation = gql`
${fragmentVariant} ${channelListingProductVariantFragment}
${channelListingProductFragment}
${productChannelListingErrorFragment} ${productChannelListingErrorFragment}
mutation ProductVariantChannelListingUpdate( mutation ProductVariantChannelListingUpdate(
$id: ID! $id: ID!
@ -581,7 +664,15 @@ export const ProductVariantChannelListingUpdateMutation = gql`
) { ) {
productVariantChannelListingUpdate(id: $id, input: $input) { productVariantChannelListingUpdate(id: $id, input: $input) {
variant { variant {
...ProductVariant id
channelListings {
...ChannelListingProductVariantFragment
}
product {
channelListings {
...ChannelListingProductFragment
}
}
} }
errors { errors {
...ProductChannelListingErrorFragment ...ProductChannelListingErrorFragment

View file

@ -1,4 +1,7 @@
import { attributeValueFragment } from "@saleor/fragments/attributes"; import {
attributeValueFragment,
attributeValueListFragment
} from "@saleor/fragments/attributes";
import { pageInfoFragment } from "@saleor/fragments/pageInfo"; import { pageInfoFragment } from "@saleor/fragments/pageInfo";
import { import {
fragmentVariant, fragmentVariant,
@ -24,7 +27,10 @@ import {
GridAttributes, GridAttributes,
GridAttributesVariables GridAttributesVariables
} from "./types/GridAttributes"; } from "./types/GridAttributes";
import { InitialProductFilterAttributes } from "./types/InitialProductFilterAttributes"; import {
InitialProductFilterAttributes,
InitialProductFilterAttributesVariables
} from "./types/InitialProductFilterAttributes";
import { import {
InitialProductFilterCategories, InitialProductFilterCategories,
InitialProductFilterCategoriesVariables InitialProductFilterCategoriesVariables
@ -54,7 +60,13 @@ import {
} from "./types/ProductVariantDetails"; } from "./types/ProductVariantDetails";
const initialProductFilterAttributesQuery = gql` const initialProductFilterAttributesQuery = gql`
query InitialProductFilterAttributes { ${pageInfoFragment}
query InitialProductFilterAttributes(
$firstValues: Int
$afterValues: String
$lastValues: Int
$beforeValues: String
) {
attributes( attributes(
first: 100 first: 100
filter: { filterableInDashboard: true, type: PRODUCT_TYPE } filter: { filterableInDashboard: true, type: PRODUCT_TYPE }
@ -64,7 +76,18 @@ const initialProductFilterAttributesQuery = gql`
id id
name name
slug slug
values { choices(
first: $firstValues
after: $afterValues
last: $lastValues
before: $beforeValues
) {
pageInfo {
...PageInfoFragment
}
edges {
cursor
node {
id id
name name
slug slug
@ -73,10 +96,12 @@ const initialProductFilterAttributesQuery = gql`
} }
} }
} }
}
}
`; `;
export const useInitialProductFilterAttributesQuery = makeQuery< export const useInitialProductFilterAttributesQuery = makeQuery<
InitialProductFilterAttributes, InitialProductFilterAttributes,
null InitialProductFilterAttributesVariables
>(initialProductFilterAttributesQuery); >(initialProductFilterAttributesQuery);
const initialProductFilterCategoriesQuery = gql` const initialProductFilterCategoriesQuery = gql`
@ -192,7 +217,14 @@ export const useProductCountQuery = makeQuery<
const productDetailsQuery = gql` const productDetailsQuery = gql`
${productFragmentDetails} ${productFragmentDetails}
${taxTypeFragment} ${taxTypeFragment}
query ProductDetails($id: ID!, $channel: String) { query ProductDetails(
$id: ID!
$channel: String
$firstValues: Int
$afterValues: String
$lastValues: Int
$beforeValues: String
) {
product(id: $id, channel: $channel) { product(id: $id, channel: $channel) {
...Product ...Product
} }
@ -208,8 +240,14 @@ export const useProductDetails = makeQuery<
const productTypeQuery = gql` const productTypeQuery = gql`
${taxTypeFragment} ${taxTypeFragment}
${attributeValueFragment} ${attributeValueListFragment}
query ProductType($id: ID!) { query ProductType(
$id: ID!
$firstValues: Int
$afterValues: String
$lastValues: Int
$beforeValues: String
) {
productType(id: $id) { productType(id: $id) {
id id
name name
@ -222,8 +260,13 @@ const productTypeQuery = gql`
name name
valueRequired valueRequired
unit unit
values { choices(
...AttributeValueFragment first: $firstValues
after: $afterValues
last: $lastValues
before: $beforeValues
) {
...AttributeValueListFragment
} }
} }
taxType { taxType {
@ -238,7 +281,13 @@ export const useProductTypeQuery = makeQuery<ProductType, ProductTypeVariables>(
const productVariantQuery = gql` const productVariantQuery = gql`
${fragmentVariant} ${fragmentVariant}
query ProductVariantDetails($id: ID!) { query ProductVariantDetails(
$id: ID!
$firstValues: Int
$afterValues: String
$lastValues: Int
$beforeValues: String
) {
productVariant(id: $id) { productVariant(id: $id) {
...ProductVariant ...ProductVariant
} }
@ -251,7 +300,13 @@ export const useProductVariantQuery = makeQuery<
const productVariantCreateQuery = gql` const productVariantCreateQuery = gql`
${variantAttributeFragment} ${variantAttributeFragment}
query ProductVariantCreateData($id: ID!) { query ProductVariantCreateData(
$id: ID!
$firstValues: Int
$afterValues: String
$lastValues: Int
$beforeValues: String
) {
product(id: $id) { product(id: $id) {
id id
media { media {
@ -370,7 +425,13 @@ export const useAvailableInGridAttributesQuery = makeQuery<
const createMultipleVariantsData = gql` const createMultipleVariantsData = gql`
${productVariantAttributesFragment} ${productVariantAttributesFragment}
${warehouseFragment} ${warehouseFragment}
query CreateMultipleVariantsData($id: ID!) { query CreateMultipleVariantsData(
$id: ID!
$firstValues: Int
$afterValues: String
$lastValues: Int
$beforeValues: String
) {
product(id: $id) { product(id: $id) {
...ProductVariantAttributesFragment ...ProductVariantAttributesFragment
} }

View file

@ -9,22 +9,42 @@ import { AttributeInputTypeEnum, AttributeEntityTypeEnum, MeasurementUnitsEnum }
// GraphQL query operation: CreateMultipleVariantsData // GraphQL query operation: CreateMultipleVariantsData
// ==================================================== // ====================================================
export interface CreateMultipleVariantsData_product_attributes_attribute_values_file { export interface CreateMultipleVariantsData_product_attributes_attribute_choices_pageInfo {
__typename: "PageInfo";
endCursor: string | null;
hasNextPage: boolean;
hasPreviousPage: boolean;
startCursor: string | null;
}
export interface CreateMultipleVariantsData_product_attributes_attribute_choices_edges_node_file {
__typename: "File"; __typename: "File";
url: string; url: string;
contentType: string | null; contentType: string | null;
} }
export interface CreateMultipleVariantsData_product_attributes_attribute_values { export interface CreateMultipleVariantsData_product_attributes_attribute_choices_edges_node {
__typename: "AttributeValue"; __typename: "AttributeValue";
id: string; id: string;
name: string | null; name: string | null;
slug: string | null; slug: string | null;
file: CreateMultipleVariantsData_product_attributes_attribute_values_file | null; file: CreateMultipleVariantsData_product_attributes_attribute_choices_edges_node_file | null;
reference: string | null; reference: string | null;
richText: any | null; richText: any | null;
} }
export interface CreateMultipleVariantsData_product_attributes_attribute_choices_edges {
__typename: "AttributeValueCountableEdge";
cursor: string;
node: CreateMultipleVariantsData_product_attributes_attribute_choices_edges_node;
}
export interface CreateMultipleVariantsData_product_attributes_attribute_choices {
__typename: "AttributeValueCountableConnection";
pageInfo: CreateMultipleVariantsData_product_attributes_attribute_choices_pageInfo;
edges: CreateMultipleVariantsData_product_attributes_attribute_choices_edges[];
}
export interface CreateMultipleVariantsData_product_attributes_attribute { export interface CreateMultipleVariantsData_product_attributes_attribute {
__typename: "Attribute"; __typename: "Attribute";
id: string; id: string;
@ -34,7 +54,7 @@ export interface CreateMultipleVariantsData_product_attributes_attribute {
entityType: AttributeEntityTypeEnum | null; entityType: AttributeEntityTypeEnum | null;
valueRequired: boolean; valueRequired: boolean;
unit: MeasurementUnitsEnum | null; unit: MeasurementUnitsEnum | null;
values: (CreateMultipleVariantsData_product_attributes_attribute_values | null)[] | null; choices: CreateMultipleVariantsData_product_attributes_attribute_choices | null;
} }
export interface CreateMultipleVariantsData_product_attributes_values_file { export interface CreateMultipleVariantsData_product_attributes_values_file {
@ -59,27 +79,47 @@ export interface CreateMultipleVariantsData_product_attributes {
values: (CreateMultipleVariantsData_product_attributes_values | null)[]; values: (CreateMultipleVariantsData_product_attributes_values | null)[];
} }
export interface CreateMultipleVariantsData_product_productType_variantAttributes_values_file { export interface CreateMultipleVariantsData_product_productType_variantAttributes_choices_pageInfo {
__typename: "PageInfo";
endCursor: string | null;
hasNextPage: boolean;
hasPreviousPage: boolean;
startCursor: string | null;
}
export interface CreateMultipleVariantsData_product_productType_variantAttributes_choices_edges_node_file {
__typename: "File"; __typename: "File";
url: string; url: string;
contentType: string | null; contentType: string | null;
} }
export interface CreateMultipleVariantsData_product_productType_variantAttributes_values { export interface CreateMultipleVariantsData_product_productType_variantAttributes_choices_edges_node {
__typename: "AttributeValue"; __typename: "AttributeValue";
id: string; id: string;
name: string | null; name: string | null;
slug: string | null; slug: string | null;
file: CreateMultipleVariantsData_product_productType_variantAttributes_values_file | null; file: CreateMultipleVariantsData_product_productType_variantAttributes_choices_edges_node_file | null;
reference: string | null; reference: string | null;
richText: any | null; richText: any | null;
} }
export interface CreateMultipleVariantsData_product_productType_variantAttributes_choices_edges {
__typename: "AttributeValueCountableEdge";
cursor: string;
node: CreateMultipleVariantsData_product_productType_variantAttributes_choices_edges_node;
}
export interface CreateMultipleVariantsData_product_productType_variantAttributes_choices {
__typename: "AttributeValueCountableConnection";
pageInfo: CreateMultipleVariantsData_product_productType_variantAttributes_choices_pageInfo;
edges: CreateMultipleVariantsData_product_productType_variantAttributes_choices_edges[];
}
export interface CreateMultipleVariantsData_product_productType_variantAttributes { export interface CreateMultipleVariantsData_product_productType_variantAttributes {
__typename: "Attribute"; __typename: "Attribute";
id: string; id: string;
name: string | null; name: string | null;
values: (CreateMultipleVariantsData_product_productType_variantAttributes_values | null)[] | null; choices: CreateMultipleVariantsData_product_productType_variantAttributes_choices | null;
} }
export interface CreateMultipleVariantsData_product_productType { export interface CreateMultipleVariantsData_product_productType {
@ -165,4 +205,8 @@ export interface CreateMultipleVariantsData {
export interface CreateMultipleVariantsDataVariables { export interface CreateMultipleVariantsDataVariables {
id: string; id: string;
firstValues?: number | null;
afterValues?: string | null;
lastValues?: number | null;
beforeValues?: string | null;
} }

View file

@ -7,19 +7,39 @@
// GraphQL query operation: InitialProductFilterAttributes // GraphQL query operation: InitialProductFilterAttributes
// ==================================================== // ====================================================
export interface InitialProductFilterAttributes_attributes_edges_node_values { export interface InitialProductFilterAttributes_attributes_edges_node_choices_pageInfo {
__typename: "PageInfo";
endCursor: string | null;
hasNextPage: boolean;
hasPreviousPage: boolean;
startCursor: string | null;
}
export interface InitialProductFilterAttributes_attributes_edges_node_choices_edges_node {
__typename: "AttributeValue"; __typename: "AttributeValue";
id: string; id: string;
name: string | null; name: string | null;
slug: string | null; slug: string | null;
} }
export interface InitialProductFilterAttributes_attributes_edges_node_choices_edges {
__typename: "AttributeValueCountableEdge";
cursor: string;
node: InitialProductFilterAttributes_attributes_edges_node_choices_edges_node;
}
export interface InitialProductFilterAttributes_attributes_edges_node_choices {
__typename: "AttributeValueCountableConnection";
pageInfo: InitialProductFilterAttributes_attributes_edges_node_choices_pageInfo;
edges: InitialProductFilterAttributes_attributes_edges_node_choices_edges[];
}
export interface InitialProductFilterAttributes_attributes_edges_node { export interface InitialProductFilterAttributes_attributes_edges_node {
__typename: "Attribute"; __typename: "Attribute";
id: string; id: string;
name: string | null; name: string | null;
slug: string | null; slug: string | null;
values: (InitialProductFilterAttributes_attributes_edges_node_values | null)[] | null; choices: InitialProductFilterAttributes_attributes_edges_node_choices | null;
} }
export interface InitialProductFilterAttributes_attributes_edges { export interface InitialProductFilterAttributes_attributes_edges {
@ -35,3 +55,10 @@ export interface InitialProductFilterAttributes_attributes {
export interface InitialProductFilterAttributes { export interface InitialProductFilterAttributes {
attributes: InitialProductFilterAttributes_attributes | null; attributes: InitialProductFilterAttributes_attributes | null;
} }
export interface InitialProductFilterAttributesVariables {
firstValues?: number | null;
afterValues?: string | null;
lastValues?: number | null;
beforeValues?: string | null;
}

View file

@ -3,100 +3,12 @@
// @generated // @generated
// This file was automatically generated and should not be edited. // This file was automatically generated and should not be edited.
import { ProductChannelListingUpdateInput, AttributeInputTypeEnum, AttributeEntityTypeEnum, MeasurementUnitsEnum, ProductMediaType, WeightUnitsEnum, ProductErrorCode } from "./../../types/globalTypes"; import { ProductChannelListingUpdateInput, ProductErrorCode } from "./../../types/globalTypes";
// ==================================================== // ====================================================
// GraphQL mutation operation: ProductChannelListingUpdate // GraphQL mutation operation: ProductChannelListingUpdate
// ==================================================== // ====================================================
export interface ProductChannelListingUpdate_productChannelListingUpdate_product_attributes_attribute_values_file {
__typename: "File";
url: string;
contentType: string | null;
}
export interface ProductChannelListingUpdate_productChannelListingUpdate_product_attributes_attribute_values {
__typename: "AttributeValue";
id: string;
name: string | null;
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 {
__typename: "Attribute";
id: string;
slug: string | null;
name: string | null;
inputType: AttributeInputTypeEnum | null;
entityType: AttributeEntityTypeEnum | null;
valueRequired: boolean;
unit: MeasurementUnitsEnum | null;
values: (ProductChannelListingUpdate_productChannelListingUpdate_product_attributes_attribute_values | null)[] | null;
}
export interface ProductChannelListingUpdate_productChannelListingUpdate_product_attributes_values_file {
__typename: "File";
url: string;
contentType: string | null;
}
export interface ProductChannelListingUpdate_productChannelListingUpdate_product_attributes_values {
__typename: "AttributeValue";
id: string;
name: string | null;
slug: string | null;
file: ProductChannelListingUpdate_productChannelListingUpdate_product_attributes_values_file | null;
reference: string | null;
richText: any | null;
}
export interface ProductChannelListingUpdate_productChannelListingUpdate_product_attributes {
__typename: "SelectedAttribute";
attribute: ProductChannelListingUpdate_productChannelListingUpdate_product_attributes_attribute;
values: (ProductChannelListingUpdate_productChannelListingUpdate_product_attributes_values | null)[];
}
export interface ProductChannelListingUpdate_productChannelListingUpdate_product_productType_variantAttributes_values_file {
__typename: "File";
url: string;
contentType: string | null;
}
export interface ProductChannelListingUpdate_productChannelListingUpdate_product_productType_variantAttributes_values {
__typename: "AttributeValue";
id: string;
name: string | null;
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 {
__typename: "Attribute";
id: string;
name: string | null;
values: (ProductChannelListingUpdate_productChannelListingUpdate_product_productType_variantAttributes_values | null)[] | null;
}
export interface ProductChannelListingUpdate_productChannelListingUpdate_product_productType_taxType {
__typename: "TaxType";
description: string | null;
taxCode: string | null;
}
export interface ProductChannelListingUpdate_productChannelListingUpdate_product_productType {
__typename: "ProductType";
id: string;
variantAttributes: (ProductChannelListingUpdate_productChannelListingUpdate_product_productType_variantAttributes | null)[] | null;
name: string;
hasVariants: boolean;
taxType: ProductChannelListingUpdate_productChannelListingUpdate_product_productType_taxType | null;
}
export interface ProductChannelListingUpdate_productChannelListingUpdate_product_channelListings_channel { export interface ProductChannelListingUpdate_productChannelListingUpdate_product_channelListings_channel {
__typename: "Channel"; __typename: "Channel";
id: string; id: string;
@ -139,71 +51,13 @@ export interface ProductChannelListingUpdate_productChannelListingUpdate_product
export interface ProductChannelListingUpdate_productChannelListingUpdate_product_channelListings { export interface ProductChannelListingUpdate_productChannelListingUpdate_product_channelListings {
__typename: "ProductChannelListing"; __typename: "ProductChannelListing";
channel: ProductChannelListingUpdate_productChannelListingUpdate_product_channelListings_channel;
pricing: ProductChannelListingUpdate_productChannelListingUpdate_product_channelListings_pricing | null;
isPublished: boolean; isPublished: boolean;
publicationDate: any | null; publicationDate: any | null;
isAvailableForPurchase: boolean | null; isAvailableForPurchase: boolean | null;
availableForPurchase: any | null; availableForPurchase: any | null;
visibleInListings: boolean; visibleInListings: boolean;
} channel: ProductChannelListingUpdate_productChannelListingUpdate_product_channelListings_channel;
pricing: ProductChannelListingUpdate_productChannelListingUpdate_product_channelListings_pricing | null;
export interface ProductChannelListingUpdate_productChannelListingUpdate_product_metadata {
__typename: "MetadataItem";
key: string;
value: string;
}
export interface ProductChannelListingUpdate_productChannelListingUpdate_product_privateMetadata {
__typename: "MetadataItem";
key: string;
value: string;
}
export interface ProductChannelListingUpdate_productChannelListingUpdate_product_defaultVariant {
__typename: "ProductVariant";
id: string;
}
export interface ProductChannelListingUpdate_productChannelListingUpdate_product_category {
__typename: "Category";
id: string;
name: string;
}
export interface ProductChannelListingUpdate_productChannelListingUpdate_product_collections {
__typename: "Collection";
id: string;
name: string;
}
export interface ProductChannelListingUpdate_productChannelListingUpdate_product_media {
__typename: "ProductMedia";
id: string;
alt: string;
sortOrder: number | null;
url: string;
type: ProductMediaType;
oembedData: any;
}
export interface ProductChannelListingUpdate_productChannelListingUpdate_product_variants_media {
__typename: "ProductMedia";
url: string;
}
export interface ProductChannelListingUpdate_productChannelListingUpdate_product_variants_stocks_warehouse {
__typename: "Warehouse";
id: string;
name: string;
}
export interface ProductChannelListingUpdate_productChannelListingUpdate_product_variants_stocks {
__typename: "Stock";
id: string;
quantity: number;
quantityAllocated: number;
warehouse: ProductChannelListingUpdate_productChannelListingUpdate_product_variants_stocks_warehouse;
} }
export interface ProductChannelListingUpdate_productChannelListingUpdate_product_variants_channelListings_channel { export interface ProductChannelListingUpdate_productChannelListingUpdate_product_variants_channelListings_channel {
@ -235,50 +89,14 @@ export interface ProductChannelListingUpdate_productChannelListingUpdate_product
export interface ProductChannelListingUpdate_productChannelListingUpdate_product_variants { export interface ProductChannelListingUpdate_productChannelListingUpdate_product_variants {
__typename: "ProductVariant"; __typename: "ProductVariant";
id: string; id: string;
sku: string;
name: string;
margin: number | null;
media: ProductChannelListingUpdate_productChannelListingUpdate_product_variants_media[] | null;
stocks: (ProductChannelListingUpdate_productChannelListingUpdate_product_variants_stocks | null)[] | null;
trackInventory: boolean;
channelListings: ProductChannelListingUpdate_productChannelListingUpdate_product_variants_channelListings[] | null; channelListings: ProductChannelListingUpdate_productChannelListingUpdate_product_variants_channelListings[] | null;
} }
export interface ProductChannelListingUpdate_productChannelListingUpdate_product_weight {
__typename: "Weight";
unit: WeightUnitsEnum;
value: number;
}
export interface ProductChannelListingUpdate_productChannelListingUpdate_product_taxType {
__typename: "TaxType";
description: string | null;
taxCode: string | null;
}
export interface ProductChannelListingUpdate_productChannelListingUpdate_product { export interface ProductChannelListingUpdate_productChannelListingUpdate_product {
__typename: "Product"; __typename: "Product";
id: string; id: string;
attributes: ProductChannelListingUpdate_productChannelListingUpdate_product_attributes[];
productType: ProductChannelListingUpdate_productChannelListingUpdate_product_productType;
channelListings: ProductChannelListingUpdate_productChannelListingUpdate_product_channelListings[] | null; channelListings: ProductChannelListingUpdate_productChannelListingUpdate_product_channelListings[] | null;
metadata: (ProductChannelListingUpdate_productChannelListingUpdate_product_metadata | null)[];
privateMetadata: (ProductChannelListingUpdate_productChannelListingUpdate_product_privateMetadata | null)[];
name: string;
slug: string;
description: any | null;
seoTitle: string | null;
seoDescription: string | null;
rating: number | null;
defaultVariant: ProductChannelListingUpdate_productChannelListingUpdate_product_defaultVariant | null;
category: ProductChannelListingUpdate_productChannelListingUpdate_product_category | null;
collections: (ProductChannelListingUpdate_productChannelListingUpdate_product_collections | null)[] | null;
chargeTaxes: boolean;
media: ProductChannelListingUpdate_productChannelListingUpdate_product_media[] | null;
isAvailable: boolean | null;
variants: (ProductChannelListingUpdate_productChannelListingUpdate_product_variants | null)[] | null; variants: (ProductChannelListingUpdate_productChannelListingUpdate_product_variants | null)[] | null;
weight: ProductChannelListingUpdate_productChannelListingUpdate_product_weight | null;
taxType: ProductChannelListingUpdate_productChannelListingUpdate_product_taxType | null;
} }
export interface ProductChannelListingUpdate_productChannelListingUpdate_errors { export interface ProductChannelListingUpdate_productChannelListingUpdate_errors {

View file

@ -3,7 +3,7 @@
// @generated // @generated
// This file was automatically generated and should not be edited. // This file was automatically generated and should not be edited.
import { ProductCreateInput, ProductErrorCode, AttributeInputTypeEnum, AttributeEntityTypeEnum, MeasurementUnitsEnum, ProductMediaType, WeightUnitsEnum } from "./../../types/globalTypes"; import { ProductCreateInput, ProductErrorCode } from "./../../types/globalTypes";
// ==================================================== // ====================================================
// GraphQL mutation operation: ProductCreate // GraphQL mutation operation: ProductCreate
@ -16,276 +16,9 @@ export interface ProductCreate_productCreate_errors {
attributes: string[] | null; attributes: string[] | null;
} }
export interface ProductCreate_productCreate_product_attributes_attribute_values_file {
__typename: "File";
url: string;
contentType: string | null;
}
export interface ProductCreate_productCreate_product_attributes_attribute_values {
__typename: "AttributeValue";
id: string;
name: string | null;
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 {
__typename: "Attribute";
id: string;
slug: string | null;
name: string | null;
inputType: AttributeInputTypeEnum | null;
entityType: AttributeEntityTypeEnum | null;
valueRequired: boolean;
unit: MeasurementUnitsEnum | null;
values: (ProductCreate_productCreate_product_attributes_attribute_values | null)[] | null;
}
export interface ProductCreate_productCreate_product_attributes_values_file {
__typename: "File";
url: string;
contentType: string | null;
}
export interface ProductCreate_productCreate_product_attributes_values {
__typename: "AttributeValue";
id: string;
name: string | null;
slug: string | null;
file: ProductCreate_productCreate_product_attributes_values_file | null;
reference: string | null;
richText: any | null;
}
export interface ProductCreate_productCreate_product_attributes {
__typename: "SelectedAttribute";
attribute: ProductCreate_productCreate_product_attributes_attribute;
values: (ProductCreate_productCreate_product_attributes_values | null)[];
}
export interface ProductCreate_productCreate_product_productType_variantAttributes_values_file {
__typename: "File";
url: string;
contentType: string | null;
}
export interface ProductCreate_productCreate_product_productType_variantAttributes_values {
__typename: "AttributeValue";
id: string;
name: string | null;
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 {
__typename: "Attribute";
id: string;
name: string | null;
values: (ProductCreate_productCreate_product_productType_variantAttributes_values | null)[] | null;
}
export interface ProductCreate_productCreate_product_productType_taxType {
__typename: "TaxType";
description: string | null;
taxCode: string | null;
}
export interface ProductCreate_productCreate_product_productType {
__typename: "ProductType";
id: string;
variantAttributes: (ProductCreate_productCreate_product_productType_variantAttributes | null)[] | null;
name: string;
hasVariants: boolean;
taxType: ProductCreate_productCreate_product_productType_taxType | null;
}
export interface ProductCreate_productCreate_product_channelListings_channel {
__typename: "Channel";
id: string;
name: string;
currencyCode: string;
}
export interface ProductCreate_productCreate_product_channelListings_pricing_priceRange_start_net {
__typename: "Money";
amount: number;
currency: string;
}
export interface ProductCreate_productCreate_product_channelListings_pricing_priceRange_start {
__typename: "TaxedMoney";
net: ProductCreate_productCreate_product_channelListings_pricing_priceRange_start_net;
}
export interface ProductCreate_productCreate_product_channelListings_pricing_priceRange_stop_net {
__typename: "Money";
amount: number;
currency: string;
}
export interface ProductCreate_productCreate_product_channelListings_pricing_priceRange_stop {
__typename: "TaxedMoney";
net: ProductCreate_productCreate_product_channelListings_pricing_priceRange_stop_net;
}
export interface ProductCreate_productCreate_product_channelListings_pricing_priceRange {
__typename: "TaxedMoneyRange";
start: ProductCreate_productCreate_product_channelListings_pricing_priceRange_start | null;
stop: ProductCreate_productCreate_product_channelListings_pricing_priceRange_stop | null;
}
export interface ProductCreate_productCreate_product_channelListings_pricing {
__typename: "ProductPricingInfo";
priceRange: ProductCreate_productCreate_product_channelListings_pricing_priceRange | null;
}
export interface ProductCreate_productCreate_product_channelListings {
__typename: "ProductChannelListing";
channel: ProductCreate_productCreate_product_channelListings_channel;
pricing: ProductCreate_productCreate_product_channelListings_pricing | null;
isPublished: boolean;
publicationDate: any | null;
isAvailableForPurchase: boolean | null;
availableForPurchase: any | null;
visibleInListings: boolean;
}
export interface ProductCreate_productCreate_product_metadata {
__typename: "MetadataItem";
key: string;
value: string;
}
export interface ProductCreate_productCreate_product_privateMetadata {
__typename: "MetadataItem";
key: string;
value: string;
}
export interface ProductCreate_productCreate_product_defaultVariant {
__typename: "ProductVariant";
id: string;
}
export interface ProductCreate_productCreate_product_category {
__typename: "Category";
id: string;
name: string;
}
export interface ProductCreate_productCreate_product_collections {
__typename: "Collection";
id: string;
name: string;
}
export interface ProductCreate_productCreate_product_media {
__typename: "ProductMedia";
id: string;
alt: string;
sortOrder: number | null;
url: string;
type: ProductMediaType;
oembedData: any;
}
export interface ProductCreate_productCreate_product_variants_media {
__typename: "ProductMedia";
url: string;
}
export interface ProductCreate_productCreate_product_variants_stocks_warehouse {
__typename: "Warehouse";
id: string;
name: string;
}
export interface ProductCreate_productCreate_product_variants_stocks {
__typename: "Stock";
id: string;
quantity: number;
quantityAllocated: number;
warehouse: ProductCreate_productCreate_product_variants_stocks_warehouse;
}
export interface ProductCreate_productCreate_product_variants_channelListings_channel {
__typename: "Channel";
id: string;
name: string;
currencyCode: string;
}
export interface ProductCreate_productCreate_product_variants_channelListings_price {
__typename: "Money";
amount: number;
currency: string;
}
export interface ProductCreate_productCreate_product_variants_channelListings_costPrice {
__typename: "Money";
amount: number;
currency: string;
}
export interface ProductCreate_productCreate_product_variants_channelListings {
__typename: "ProductVariantChannelListing";
channel: ProductCreate_productCreate_product_variants_channelListings_channel;
price: ProductCreate_productCreate_product_variants_channelListings_price | null;
costPrice: ProductCreate_productCreate_product_variants_channelListings_costPrice | null;
}
export interface ProductCreate_productCreate_product_variants {
__typename: "ProductVariant";
id: string;
sku: string;
name: string;
margin: number | null;
media: ProductCreate_productCreate_product_variants_media[] | null;
stocks: (ProductCreate_productCreate_product_variants_stocks | null)[] | null;
trackInventory: boolean;
channelListings: ProductCreate_productCreate_product_variants_channelListings[] | null;
}
export interface ProductCreate_productCreate_product_weight {
__typename: "Weight";
unit: WeightUnitsEnum;
value: number;
}
export interface ProductCreate_productCreate_product_taxType {
__typename: "TaxType";
description: string | null;
taxCode: string | null;
}
export interface ProductCreate_productCreate_product { export interface ProductCreate_productCreate_product {
__typename: "Product"; __typename: "Product";
id: string; id: string;
attributes: ProductCreate_productCreate_product_attributes[];
productType: ProductCreate_productCreate_product_productType;
channelListings: ProductCreate_productCreate_product_channelListings[] | null;
metadata: (ProductCreate_productCreate_product_metadata | null)[];
privateMetadata: (ProductCreate_productCreate_product_privateMetadata | null)[];
name: string;
slug: string;
description: any | null;
seoTitle: string | null;
seoDescription: string | null;
rating: number | null;
defaultVariant: ProductCreate_productCreate_product_defaultVariant | null;
category: ProductCreate_productCreate_product_category | null;
collections: (ProductCreate_productCreate_product_collections | null)[] | null;
chargeTaxes: boolean;
media: ProductCreate_productCreate_product_media[] | null;
isAvailable: boolean | null;
variants: (ProductCreate_productCreate_product_variants | null)[] | null;
weight: ProductCreate_productCreate_product_weight | null;
taxType: ProductCreate_productCreate_product_taxType | null;
} }
export interface ProductCreate_productCreate { export interface ProductCreate_productCreate {

View file

@ -9,22 +9,42 @@ import { AttributeInputTypeEnum, AttributeEntityTypeEnum, MeasurementUnitsEnum,
// GraphQL query operation: ProductDetails // GraphQL query operation: ProductDetails
// ==================================================== // ====================================================
export interface ProductDetails_product_attributes_attribute_values_file { export interface ProductDetails_product_attributes_attribute_choices_pageInfo {
__typename: "PageInfo";
endCursor: string | null;
hasNextPage: boolean;
hasPreviousPage: boolean;
startCursor: string | null;
}
export interface ProductDetails_product_attributes_attribute_choices_edges_node_file {
__typename: "File"; __typename: "File";
url: string; url: string;
contentType: string | null; contentType: string | null;
} }
export interface ProductDetails_product_attributes_attribute_values { export interface ProductDetails_product_attributes_attribute_choices_edges_node {
__typename: "AttributeValue"; __typename: "AttributeValue";
id: string; id: string;
name: string | null; name: string | null;
slug: string | null; slug: string | null;
file: ProductDetails_product_attributes_attribute_values_file | null; file: ProductDetails_product_attributes_attribute_choices_edges_node_file | null;
reference: string | null; reference: string | null;
richText: any | null; richText: any | null;
} }
export interface ProductDetails_product_attributes_attribute_choices_edges {
__typename: "AttributeValueCountableEdge";
cursor: string;
node: ProductDetails_product_attributes_attribute_choices_edges_node;
}
export interface ProductDetails_product_attributes_attribute_choices {
__typename: "AttributeValueCountableConnection";
pageInfo: ProductDetails_product_attributes_attribute_choices_pageInfo;
edges: ProductDetails_product_attributes_attribute_choices_edges[];
}
export interface ProductDetails_product_attributes_attribute { export interface ProductDetails_product_attributes_attribute {
__typename: "Attribute"; __typename: "Attribute";
id: string; id: string;
@ -34,7 +54,7 @@ export interface ProductDetails_product_attributes_attribute {
entityType: AttributeEntityTypeEnum | null; entityType: AttributeEntityTypeEnum | null;
valueRequired: boolean; valueRequired: boolean;
unit: MeasurementUnitsEnum | null; unit: MeasurementUnitsEnum | null;
values: (ProductDetails_product_attributes_attribute_values | null)[] | null; choices: ProductDetails_product_attributes_attribute_choices | null;
} }
export interface ProductDetails_product_attributes_values_file { export interface ProductDetails_product_attributes_values_file {
@ -59,27 +79,47 @@ export interface ProductDetails_product_attributes {
values: (ProductDetails_product_attributes_values | null)[]; values: (ProductDetails_product_attributes_values | null)[];
} }
export interface ProductDetails_product_productType_variantAttributes_values_file { export interface ProductDetails_product_productType_variantAttributes_choices_pageInfo {
__typename: "PageInfo";
endCursor: string | null;
hasNextPage: boolean;
hasPreviousPage: boolean;
startCursor: string | null;
}
export interface ProductDetails_product_productType_variantAttributes_choices_edges_node_file {
__typename: "File"; __typename: "File";
url: string; url: string;
contentType: string | null; contentType: string | null;
} }
export interface ProductDetails_product_productType_variantAttributes_values { export interface ProductDetails_product_productType_variantAttributes_choices_edges_node {
__typename: "AttributeValue"; __typename: "AttributeValue";
id: string; id: string;
name: string | null; name: string | null;
slug: string | null; slug: string | null;
file: ProductDetails_product_productType_variantAttributes_values_file | null; file: ProductDetails_product_productType_variantAttributes_choices_edges_node_file | null;
reference: string | null; reference: string | null;
richText: any | null; richText: any | null;
} }
export interface ProductDetails_product_productType_variantAttributes_choices_edges {
__typename: "AttributeValueCountableEdge";
cursor: string;
node: ProductDetails_product_productType_variantAttributes_choices_edges_node;
}
export interface ProductDetails_product_productType_variantAttributes_choices {
__typename: "AttributeValueCountableConnection";
pageInfo: ProductDetails_product_productType_variantAttributes_choices_pageInfo;
edges: ProductDetails_product_productType_variantAttributes_choices_edges[];
}
export interface ProductDetails_product_productType_variantAttributes { export interface ProductDetails_product_productType_variantAttributes {
__typename: "Attribute"; __typename: "Attribute";
id: string; id: string;
name: string | null; name: string | null;
values: (ProductDetails_product_productType_variantAttributes_values | null)[] | null; choices: ProductDetails_product_productType_variantAttributes_choices | null;
} }
export interface ProductDetails_product_productType_taxType { export interface ProductDetails_product_productType_taxType {
@ -295,4 +335,8 @@ export interface ProductDetails {
export interface ProductDetailsVariables { export interface ProductDetailsVariables {
id: string; id: string;
channel?: string | null; channel?: string | null;
firstValues?: number | null;
afterValues?: string | null;
lastValues?: number | null;
beforeValues?: string | null;
} }

View file

@ -3,7 +3,7 @@
// @generated // @generated
// This file was automatically generated and should not be edited. // This file was automatically generated and should not be edited.
import { ProductErrorCode, AttributeInputTypeEnum, AttributeEntityTypeEnum, MeasurementUnitsEnum, ProductMediaType, WeightUnitsEnum } from "./../../types/globalTypes"; import { ProductErrorCode, ProductMediaType } from "./../../types/globalTypes";
// ==================================================== // ====================================================
// GraphQL mutation operation: ProductMediaCreate // GraphQL mutation operation: ProductMediaCreate
@ -15,174 +15,6 @@ export interface ProductMediaCreate_productMediaCreate_errors {
field: string | null; field: string | null;
} }
export interface ProductMediaCreate_productMediaCreate_product_attributes_attribute_values_file {
__typename: "File";
url: string;
contentType: string | null;
}
export interface ProductMediaCreate_productMediaCreate_product_attributes_attribute_values {
__typename: "AttributeValue";
id: string;
name: string | null;
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 {
__typename: "Attribute";
id: string;
slug: string | null;
name: string | null;
inputType: AttributeInputTypeEnum | null;
entityType: AttributeEntityTypeEnum | null;
valueRequired: boolean;
unit: MeasurementUnitsEnum | null;
values: (ProductMediaCreate_productMediaCreate_product_attributes_attribute_values | null)[] | null;
}
export interface ProductMediaCreate_productMediaCreate_product_attributes_values_file {
__typename: "File";
url: string;
contentType: string | null;
}
export interface ProductMediaCreate_productMediaCreate_product_attributes_values {
__typename: "AttributeValue";
id: string;
name: string | null;
slug: string | null;
file: ProductMediaCreate_productMediaCreate_product_attributes_values_file | null;
reference: string | null;
richText: any | null;
}
export interface ProductMediaCreate_productMediaCreate_product_attributes {
__typename: "SelectedAttribute";
attribute: ProductMediaCreate_productMediaCreate_product_attributes_attribute;
values: (ProductMediaCreate_productMediaCreate_product_attributes_values | null)[];
}
export interface ProductMediaCreate_productMediaCreate_product_productType_variantAttributes_values_file {
__typename: "File";
url: string;
contentType: string | null;
}
export interface ProductMediaCreate_productMediaCreate_product_productType_variantAttributes_values {
__typename: "AttributeValue";
id: string;
name: string | null;
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 {
__typename: "Attribute";
id: string;
name: string | null;
values: (ProductMediaCreate_productMediaCreate_product_productType_variantAttributes_values | null)[] | null;
}
export interface ProductMediaCreate_productMediaCreate_product_productType_taxType {
__typename: "TaxType";
description: string | null;
taxCode: string | null;
}
export interface ProductMediaCreate_productMediaCreate_product_productType {
__typename: "ProductType";
id: string;
variantAttributes: (ProductMediaCreate_productMediaCreate_product_productType_variantAttributes | null)[] | null;
name: string;
hasVariants: boolean;
taxType: ProductMediaCreate_productMediaCreate_product_productType_taxType | null;
}
export interface ProductMediaCreate_productMediaCreate_product_channelListings_channel {
__typename: "Channel";
id: string;
name: string;
currencyCode: string;
}
export interface ProductMediaCreate_productMediaCreate_product_channelListings_pricing_priceRange_start_net {
__typename: "Money";
amount: number;
currency: string;
}
export interface ProductMediaCreate_productMediaCreate_product_channelListings_pricing_priceRange_start {
__typename: "TaxedMoney";
net: ProductMediaCreate_productMediaCreate_product_channelListings_pricing_priceRange_start_net;
}
export interface ProductMediaCreate_productMediaCreate_product_channelListings_pricing_priceRange_stop_net {
__typename: "Money";
amount: number;
currency: string;
}
export interface ProductMediaCreate_productMediaCreate_product_channelListings_pricing_priceRange_stop {
__typename: "TaxedMoney";
net: ProductMediaCreate_productMediaCreate_product_channelListings_pricing_priceRange_stop_net;
}
export interface ProductMediaCreate_productMediaCreate_product_channelListings_pricing_priceRange {
__typename: "TaxedMoneyRange";
start: ProductMediaCreate_productMediaCreate_product_channelListings_pricing_priceRange_start | null;
stop: ProductMediaCreate_productMediaCreate_product_channelListings_pricing_priceRange_stop | null;
}
export interface ProductMediaCreate_productMediaCreate_product_channelListings_pricing {
__typename: "ProductPricingInfo";
priceRange: ProductMediaCreate_productMediaCreate_product_channelListings_pricing_priceRange | null;
}
export interface ProductMediaCreate_productMediaCreate_product_channelListings {
__typename: "ProductChannelListing";
channel: ProductMediaCreate_productMediaCreate_product_channelListings_channel;
pricing: ProductMediaCreate_productMediaCreate_product_channelListings_pricing | null;
isPublished: boolean;
publicationDate: any | null;
isAvailableForPurchase: boolean | null;
availableForPurchase: any | null;
visibleInListings: boolean;
}
export interface ProductMediaCreate_productMediaCreate_product_metadata {
__typename: "MetadataItem";
key: string;
value: string;
}
export interface ProductMediaCreate_productMediaCreate_product_privateMetadata {
__typename: "MetadataItem";
key: string;
value: string;
}
export interface ProductMediaCreate_productMediaCreate_product_defaultVariant {
__typename: "ProductVariant";
id: string;
}
export interface ProductMediaCreate_productMediaCreate_product_category {
__typename: "Category";
id: string;
name: string;
}
export interface ProductMediaCreate_productMediaCreate_product_collections {
__typename: "Collection";
id: string;
name: string;
}
export interface ProductMediaCreate_productMediaCreate_product_media { export interface ProductMediaCreate_productMediaCreate_product_media {
__typename: "ProductMedia"; __typename: "ProductMedia";
id: string; id: string;
@ -193,98 +25,10 @@ export interface ProductMediaCreate_productMediaCreate_product_media {
oembedData: any; oembedData: any;
} }
export interface ProductMediaCreate_productMediaCreate_product_variants_media {
__typename: "ProductMedia";
url: string;
}
export interface ProductMediaCreate_productMediaCreate_product_variants_stocks_warehouse {
__typename: "Warehouse";
id: string;
name: string;
}
export interface ProductMediaCreate_productMediaCreate_product_variants_stocks {
__typename: "Stock";
id: string;
quantity: number;
quantityAllocated: number;
warehouse: ProductMediaCreate_productMediaCreate_product_variants_stocks_warehouse;
}
export interface ProductMediaCreate_productMediaCreate_product_variants_channelListings_channel {
__typename: "Channel";
id: string;
name: string;
currencyCode: string;
}
export interface ProductMediaCreate_productMediaCreate_product_variants_channelListings_price {
__typename: "Money";
amount: number;
currency: string;
}
export interface ProductMediaCreate_productMediaCreate_product_variants_channelListings_costPrice {
__typename: "Money";
amount: number;
currency: string;
}
export interface ProductMediaCreate_productMediaCreate_product_variants_channelListings {
__typename: "ProductVariantChannelListing";
channel: ProductMediaCreate_productMediaCreate_product_variants_channelListings_channel;
price: ProductMediaCreate_productMediaCreate_product_variants_channelListings_price | null;
costPrice: ProductMediaCreate_productMediaCreate_product_variants_channelListings_costPrice | null;
}
export interface ProductMediaCreate_productMediaCreate_product_variants {
__typename: "ProductVariant";
id: string;
sku: string;
name: string;
margin: number | null;
media: ProductMediaCreate_productMediaCreate_product_variants_media[] | null;
stocks: (ProductMediaCreate_productMediaCreate_product_variants_stocks | null)[] | null;
trackInventory: boolean;
channelListings: ProductMediaCreate_productMediaCreate_product_variants_channelListings[] | null;
}
export interface ProductMediaCreate_productMediaCreate_product_weight {
__typename: "Weight";
unit: WeightUnitsEnum;
value: number;
}
export interface ProductMediaCreate_productMediaCreate_product_taxType {
__typename: "TaxType";
description: string | null;
taxCode: string | null;
}
export interface ProductMediaCreate_productMediaCreate_product { export interface ProductMediaCreate_productMediaCreate_product {
__typename: "Product"; __typename: "Product";
id: string; id: string;
attributes: ProductMediaCreate_productMediaCreate_product_attributes[];
productType: ProductMediaCreate_productMediaCreate_product_productType;
channelListings: ProductMediaCreate_productMediaCreate_product_channelListings[] | null;
metadata: (ProductMediaCreate_productMediaCreate_product_metadata | null)[];
privateMetadata: (ProductMediaCreate_productMediaCreate_product_privateMetadata | null)[];
name: string;
slug: string;
description: any | null;
seoTitle: string | null;
seoDescription: string | null;
rating: number | null;
defaultVariant: ProductMediaCreate_productMediaCreate_product_defaultVariant | null;
category: ProductMediaCreate_productMediaCreate_product_category | null;
collections: (ProductMediaCreate_productMediaCreate_product_collections | null)[] | null;
chargeTaxes: boolean;
media: ProductMediaCreate_productMediaCreate_product_media[] | null; media: ProductMediaCreate_productMediaCreate_product_media[] | null;
isAvailable: boolean | null;
variants: (ProductMediaCreate_productMediaCreate_product_variants | null)[] | null;
weight: ProductMediaCreate_productMediaCreate_product_weight | null;
taxType: ProductMediaCreate_productMediaCreate_product_taxType | null;
} }
export interface ProductMediaCreate_productMediaCreate { export interface ProductMediaCreate_productMediaCreate {

View file

@ -3,7 +3,7 @@
// @generated // @generated
// This file was automatically generated and should not be edited. // This file was automatically generated and should not be edited.
import { ProductErrorCode, AttributeInputTypeEnum, AttributeEntityTypeEnum, MeasurementUnitsEnum, ProductMediaType, WeightUnitsEnum } from "./../../types/globalTypes"; import { ProductErrorCode, ProductMediaType } from "./../../types/globalTypes";
// ==================================================== // ====================================================
// GraphQL mutation operation: ProductMediaUpdate // GraphQL mutation operation: ProductMediaUpdate
@ -15,174 +15,6 @@ export interface ProductMediaUpdate_productMediaUpdate_errors {
field: string | null; field: string | null;
} }
export interface ProductMediaUpdate_productMediaUpdate_product_attributes_attribute_values_file {
__typename: "File";
url: string;
contentType: string | null;
}
export interface ProductMediaUpdate_productMediaUpdate_product_attributes_attribute_values {
__typename: "AttributeValue";
id: string;
name: string | null;
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 {
__typename: "Attribute";
id: string;
slug: string | null;
name: string | null;
inputType: AttributeInputTypeEnum | null;
entityType: AttributeEntityTypeEnum | null;
valueRequired: boolean;
unit: MeasurementUnitsEnum | null;
values: (ProductMediaUpdate_productMediaUpdate_product_attributes_attribute_values | null)[] | null;
}
export interface ProductMediaUpdate_productMediaUpdate_product_attributes_values_file {
__typename: "File";
url: string;
contentType: string | null;
}
export interface ProductMediaUpdate_productMediaUpdate_product_attributes_values {
__typename: "AttributeValue";
id: string;
name: string | null;
slug: string | null;
file: ProductMediaUpdate_productMediaUpdate_product_attributes_values_file | null;
reference: string | null;
richText: any | null;
}
export interface ProductMediaUpdate_productMediaUpdate_product_attributes {
__typename: "SelectedAttribute";
attribute: ProductMediaUpdate_productMediaUpdate_product_attributes_attribute;
values: (ProductMediaUpdate_productMediaUpdate_product_attributes_values | null)[];
}
export interface ProductMediaUpdate_productMediaUpdate_product_productType_variantAttributes_values_file {
__typename: "File";
url: string;
contentType: string | null;
}
export interface ProductMediaUpdate_productMediaUpdate_product_productType_variantAttributes_values {
__typename: "AttributeValue";
id: string;
name: string | null;
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 {
__typename: "Attribute";
id: string;
name: string | null;
values: (ProductMediaUpdate_productMediaUpdate_product_productType_variantAttributes_values | null)[] | null;
}
export interface ProductMediaUpdate_productMediaUpdate_product_productType_taxType {
__typename: "TaxType";
description: string | null;
taxCode: string | null;
}
export interface ProductMediaUpdate_productMediaUpdate_product_productType {
__typename: "ProductType";
id: string;
variantAttributes: (ProductMediaUpdate_productMediaUpdate_product_productType_variantAttributes | null)[] | null;
name: string;
hasVariants: boolean;
taxType: ProductMediaUpdate_productMediaUpdate_product_productType_taxType | null;
}
export interface ProductMediaUpdate_productMediaUpdate_product_channelListings_channel {
__typename: "Channel";
id: string;
name: string;
currencyCode: string;
}
export interface ProductMediaUpdate_productMediaUpdate_product_channelListings_pricing_priceRange_start_net {
__typename: "Money";
amount: number;
currency: string;
}
export interface ProductMediaUpdate_productMediaUpdate_product_channelListings_pricing_priceRange_start {
__typename: "TaxedMoney";
net: ProductMediaUpdate_productMediaUpdate_product_channelListings_pricing_priceRange_start_net;
}
export interface ProductMediaUpdate_productMediaUpdate_product_channelListings_pricing_priceRange_stop_net {
__typename: "Money";
amount: number;
currency: string;
}
export interface ProductMediaUpdate_productMediaUpdate_product_channelListings_pricing_priceRange_stop {
__typename: "TaxedMoney";
net: ProductMediaUpdate_productMediaUpdate_product_channelListings_pricing_priceRange_stop_net;
}
export interface ProductMediaUpdate_productMediaUpdate_product_channelListings_pricing_priceRange {
__typename: "TaxedMoneyRange";
start: ProductMediaUpdate_productMediaUpdate_product_channelListings_pricing_priceRange_start | null;
stop: ProductMediaUpdate_productMediaUpdate_product_channelListings_pricing_priceRange_stop | null;
}
export interface ProductMediaUpdate_productMediaUpdate_product_channelListings_pricing {
__typename: "ProductPricingInfo";
priceRange: ProductMediaUpdate_productMediaUpdate_product_channelListings_pricing_priceRange | null;
}
export interface ProductMediaUpdate_productMediaUpdate_product_channelListings {
__typename: "ProductChannelListing";
channel: ProductMediaUpdate_productMediaUpdate_product_channelListings_channel;
pricing: ProductMediaUpdate_productMediaUpdate_product_channelListings_pricing | null;
isPublished: boolean;
publicationDate: any | null;
isAvailableForPurchase: boolean | null;
availableForPurchase: any | null;
visibleInListings: boolean;
}
export interface ProductMediaUpdate_productMediaUpdate_product_metadata {
__typename: "MetadataItem";
key: string;
value: string;
}
export interface ProductMediaUpdate_productMediaUpdate_product_privateMetadata {
__typename: "MetadataItem";
key: string;
value: string;
}
export interface ProductMediaUpdate_productMediaUpdate_product_defaultVariant {
__typename: "ProductVariant";
id: string;
}
export interface ProductMediaUpdate_productMediaUpdate_product_category {
__typename: "Category";
id: string;
name: string;
}
export interface ProductMediaUpdate_productMediaUpdate_product_collections {
__typename: "Collection";
id: string;
name: string;
}
export interface ProductMediaUpdate_productMediaUpdate_product_media { export interface ProductMediaUpdate_productMediaUpdate_product_media {
__typename: "ProductMedia"; __typename: "ProductMedia";
id: string; id: string;
@ -193,98 +25,10 @@ export interface ProductMediaUpdate_productMediaUpdate_product_media {
oembedData: any; oembedData: any;
} }
export interface ProductMediaUpdate_productMediaUpdate_product_variants_media {
__typename: "ProductMedia";
url: string;
}
export interface ProductMediaUpdate_productMediaUpdate_product_variants_stocks_warehouse {
__typename: "Warehouse";
id: string;
name: string;
}
export interface ProductMediaUpdate_productMediaUpdate_product_variants_stocks {
__typename: "Stock";
id: string;
quantity: number;
quantityAllocated: number;
warehouse: ProductMediaUpdate_productMediaUpdate_product_variants_stocks_warehouse;
}
export interface ProductMediaUpdate_productMediaUpdate_product_variants_channelListings_channel {
__typename: "Channel";
id: string;
name: string;
currencyCode: string;
}
export interface ProductMediaUpdate_productMediaUpdate_product_variants_channelListings_price {
__typename: "Money";
amount: number;
currency: string;
}
export interface ProductMediaUpdate_productMediaUpdate_product_variants_channelListings_costPrice {
__typename: "Money";
amount: number;
currency: string;
}
export interface ProductMediaUpdate_productMediaUpdate_product_variants_channelListings {
__typename: "ProductVariantChannelListing";
channel: ProductMediaUpdate_productMediaUpdate_product_variants_channelListings_channel;
price: ProductMediaUpdate_productMediaUpdate_product_variants_channelListings_price | null;
costPrice: ProductMediaUpdate_productMediaUpdate_product_variants_channelListings_costPrice | null;
}
export interface ProductMediaUpdate_productMediaUpdate_product_variants {
__typename: "ProductVariant";
id: string;
sku: string;
name: string;
margin: number | null;
media: ProductMediaUpdate_productMediaUpdate_product_variants_media[] | null;
stocks: (ProductMediaUpdate_productMediaUpdate_product_variants_stocks | null)[] | null;
trackInventory: boolean;
channelListings: ProductMediaUpdate_productMediaUpdate_product_variants_channelListings[] | null;
}
export interface ProductMediaUpdate_productMediaUpdate_product_weight {
__typename: "Weight";
unit: WeightUnitsEnum;
value: number;
}
export interface ProductMediaUpdate_productMediaUpdate_product_taxType {
__typename: "TaxType";
description: string | null;
taxCode: string | null;
}
export interface ProductMediaUpdate_productMediaUpdate_product { export interface ProductMediaUpdate_productMediaUpdate_product {
__typename: "Product"; __typename: "Product";
id: string; id: string;
attributes: ProductMediaUpdate_productMediaUpdate_product_attributes[];
productType: ProductMediaUpdate_productMediaUpdate_product_productType;
channelListings: ProductMediaUpdate_productMediaUpdate_product_channelListings[] | null;
metadata: (ProductMediaUpdate_productMediaUpdate_product_metadata | null)[];
privateMetadata: (ProductMediaUpdate_productMediaUpdate_product_privateMetadata | null)[];
name: string;
slug: string;
description: any | null;
seoTitle: string | null;
seoDescription: string | null;
rating: number | null;
defaultVariant: ProductMediaUpdate_productMediaUpdate_product_defaultVariant | null;
category: ProductMediaUpdate_productMediaUpdate_product_category | null;
collections: (ProductMediaUpdate_productMediaUpdate_product_collections | null)[] | null;
chargeTaxes: boolean;
media: ProductMediaUpdate_productMediaUpdate_product_media[] | null; media: ProductMediaUpdate_productMediaUpdate_product_media[] | null;
isAvailable: boolean | null;
variants: (ProductMediaUpdate_productMediaUpdate_product_variants | null)[] | null;
weight: ProductMediaUpdate_productMediaUpdate_product_weight | null;
taxType: ProductMediaUpdate_productMediaUpdate_product_taxType | null;
} }
export interface ProductMediaUpdate_productMediaUpdate { export interface ProductMediaUpdate_productMediaUpdate {

View file

@ -9,22 +9,42 @@ import { AttributeInputTypeEnum, AttributeEntityTypeEnum, MeasurementUnitsEnum }
// GraphQL query operation: ProductType // GraphQL query operation: ProductType
// ==================================================== // ====================================================
export interface ProductType_productType_productAttributes_values_file { export interface ProductType_productType_productAttributes_choices_pageInfo {
__typename: "PageInfo";
endCursor: string | null;
hasNextPage: boolean;
hasPreviousPage: boolean;
startCursor: string | null;
}
export interface ProductType_productType_productAttributes_choices_edges_node_file {
__typename: "File"; __typename: "File";
url: string; url: string;
contentType: string | null; contentType: string | null;
} }
export interface ProductType_productType_productAttributes_values { export interface ProductType_productType_productAttributes_choices_edges_node {
__typename: "AttributeValue"; __typename: "AttributeValue";
id: string; id: string;
name: string | null; name: string | null;
slug: string | null; slug: string | null;
file: ProductType_productType_productAttributes_values_file | null; file: ProductType_productType_productAttributes_choices_edges_node_file | null;
reference: string | null; reference: string | null;
richText: any | null; richText: any | null;
} }
export interface ProductType_productType_productAttributes_choices_edges {
__typename: "AttributeValueCountableEdge";
cursor: string;
node: ProductType_productType_productAttributes_choices_edges_node;
}
export interface ProductType_productType_productAttributes_choices {
__typename: "AttributeValueCountableConnection";
pageInfo: ProductType_productType_productAttributes_choices_pageInfo;
edges: ProductType_productType_productAttributes_choices_edges[];
}
export interface ProductType_productType_productAttributes { export interface ProductType_productType_productAttributes {
__typename: "Attribute"; __typename: "Attribute";
id: string; id: string;
@ -34,7 +54,7 @@ export interface ProductType_productType_productAttributes {
name: string | null; name: string | null;
valueRequired: boolean; valueRequired: boolean;
unit: MeasurementUnitsEnum | null; unit: MeasurementUnitsEnum | null;
values: (ProductType_productType_productAttributes_values | null)[] | null; choices: ProductType_productType_productAttributes_choices | null;
} }
export interface ProductType_productType_taxType { export interface ProductType_productType_taxType {
@ -58,4 +78,8 @@ export interface ProductType {
export interface ProductTypeVariables { export interface ProductTypeVariables {
id: string; id: string;
firstValues?: number | null;
afterValues?: string | null;
lastValues?: number | null;
beforeValues?: string | null;
} }

View file

@ -16,22 +16,42 @@ export interface ProductUpdate_productUpdate_errors {
attributes: string[] | null; attributes: string[] | null;
} }
export interface ProductUpdate_productUpdate_product_attributes_attribute_values_file { export interface ProductUpdate_productUpdate_product_attributes_attribute_choices_pageInfo {
__typename: "PageInfo";
endCursor: string | null;
hasNextPage: boolean;
hasPreviousPage: boolean;
startCursor: string | null;
}
export interface ProductUpdate_productUpdate_product_attributes_attribute_choices_edges_node_file {
__typename: "File"; __typename: "File";
url: string; url: string;
contentType: string | null; contentType: string | null;
} }
export interface ProductUpdate_productUpdate_product_attributes_attribute_values { export interface ProductUpdate_productUpdate_product_attributes_attribute_choices_edges_node {
__typename: "AttributeValue"; __typename: "AttributeValue";
id: string; id: string;
name: string | null; name: string | null;
slug: string | null; slug: string | null;
file: ProductUpdate_productUpdate_product_attributes_attribute_values_file | null; file: ProductUpdate_productUpdate_product_attributes_attribute_choices_edges_node_file | null;
reference: string | null; reference: string | null;
richText: any | null; richText: any | null;
} }
export interface ProductUpdate_productUpdate_product_attributes_attribute_choices_edges {
__typename: "AttributeValueCountableEdge";
cursor: string;
node: ProductUpdate_productUpdate_product_attributes_attribute_choices_edges_node;
}
export interface ProductUpdate_productUpdate_product_attributes_attribute_choices {
__typename: "AttributeValueCountableConnection";
pageInfo: ProductUpdate_productUpdate_product_attributes_attribute_choices_pageInfo;
edges: ProductUpdate_productUpdate_product_attributes_attribute_choices_edges[];
}
export interface ProductUpdate_productUpdate_product_attributes_attribute { export interface ProductUpdate_productUpdate_product_attributes_attribute {
__typename: "Attribute"; __typename: "Attribute";
id: string; id: string;
@ -41,7 +61,7 @@ export interface ProductUpdate_productUpdate_product_attributes_attribute {
entityType: AttributeEntityTypeEnum | null; entityType: AttributeEntityTypeEnum | null;
valueRequired: boolean; valueRequired: boolean;
unit: MeasurementUnitsEnum | null; unit: MeasurementUnitsEnum | null;
values: (ProductUpdate_productUpdate_product_attributes_attribute_values | null)[] | null; choices: ProductUpdate_productUpdate_product_attributes_attribute_choices | null;
} }
export interface ProductUpdate_productUpdate_product_attributes_values_file { export interface ProductUpdate_productUpdate_product_attributes_values_file {
@ -66,27 +86,47 @@ export interface ProductUpdate_productUpdate_product_attributes {
values: (ProductUpdate_productUpdate_product_attributes_values | null)[]; values: (ProductUpdate_productUpdate_product_attributes_values | null)[];
} }
export interface ProductUpdate_productUpdate_product_productType_variantAttributes_values_file { export interface ProductUpdate_productUpdate_product_productType_variantAttributes_choices_pageInfo {
__typename: "PageInfo";
endCursor: string | null;
hasNextPage: boolean;
hasPreviousPage: boolean;
startCursor: string | null;
}
export interface ProductUpdate_productUpdate_product_productType_variantAttributes_choices_edges_node_file {
__typename: "File"; __typename: "File";
url: string; url: string;
contentType: string | null; contentType: string | null;
} }
export interface ProductUpdate_productUpdate_product_productType_variantAttributes_values { export interface ProductUpdate_productUpdate_product_productType_variantAttributes_choices_edges_node {
__typename: "AttributeValue"; __typename: "AttributeValue";
id: string; id: string;
name: string | null; name: string | null;
slug: string | null; slug: string | null;
file: ProductUpdate_productUpdate_product_productType_variantAttributes_values_file | null; file: ProductUpdate_productUpdate_product_productType_variantAttributes_choices_edges_node_file | null;
reference: string | null; reference: string | null;
richText: any | null; richText: any | null;
} }
export interface ProductUpdate_productUpdate_product_productType_variantAttributes_choices_edges {
__typename: "AttributeValueCountableEdge";
cursor: string;
node: ProductUpdate_productUpdate_product_productType_variantAttributes_choices_edges_node;
}
export interface ProductUpdate_productUpdate_product_productType_variantAttributes_choices {
__typename: "AttributeValueCountableConnection";
pageInfo: ProductUpdate_productUpdate_product_productType_variantAttributes_choices_pageInfo;
edges: ProductUpdate_productUpdate_product_productType_variantAttributes_choices_edges[];
}
export interface ProductUpdate_productUpdate_product_productType_variantAttributes { export interface ProductUpdate_productUpdate_product_productType_variantAttributes {
__typename: "Attribute"; __typename: "Attribute";
id: string; id: string;
name: string | null; name: string | null;
values: (ProductUpdate_productUpdate_product_productType_variantAttributes_values | null)[] | null; choices: ProductUpdate_productUpdate_product_productType_variantAttributes_choices | null;
} }
export interface ProductUpdate_productUpdate_product_productType_taxType { export interface ProductUpdate_productUpdate_product_productType_taxType {
@ -301,4 +341,8 @@ export interface ProductUpdate {
export interface ProductUpdateVariables { export interface ProductUpdateVariables {
id: string; id: string;
input: ProductInput; input: ProductInput;
firstValues?: number | null;
afterValues?: string | null;
lastValues?: number | null;
beforeValues?: string | null;
} }

View file

@ -3,150 +3,36 @@
// @generated // @generated
// This file was automatically generated and should not be edited. // This file was automatically generated and should not be edited.
import { ProductVariantChannelListingAddInput, AttributeInputTypeEnum, AttributeEntityTypeEnum, MeasurementUnitsEnum, ProductMediaType, WeightUnitsEnum, ProductErrorCode } from "./../../types/globalTypes"; import { ProductVariantChannelListingAddInput, ProductErrorCode } from "./../../types/globalTypes";
// ==================================================== // ====================================================
// GraphQL mutation operation: ProductVariantChannelListingUpdate // GraphQL mutation operation: ProductVariantChannelListingUpdate
// ==================================================== // ====================================================
export interface ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_metadata { export interface ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_channelListings_channel {
__typename: "MetadataItem"; __typename: "Channel";
key: string;
value: string;
}
export interface ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_privateMetadata {
__typename: "MetadataItem";
key: string;
value: string;
}
export interface ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_selectionAttributes_attribute_values_file {
__typename: "File";
url: string;
contentType: string | null;
}
export interface ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_selectionAttributes_attribute_values {
__typename: "AttributeValue";
id: string; id: string;
name: string | null; name: string;
slug: string | null; currencyCode: string;
file: ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_selectionAttributes_attribute_values_file | null;
reference: string | null;
richText: any | null;
} }
export interface ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_selectionAttributes_attribute { export interface ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_channelListings_price {
__typename: "Attribute"; __typename: "Money";
id: string; amount: number;
name: string | null; currency: string;
slug: string | null;
inputType: AttributeInputTypeEnum | null;
entityType: AttributeEntityTypeEnum | null;
valueRequired: boolean;
unit: MeasurementUnitsEnum | null;
values: (ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_selectionAttributes_attribute_values | null)[] | null;
} }
export interface ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_selectionAttributes_values_file { export interface ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_channelListings_costPrice {
__typename: "File"; __typename: "Money";
url: string; amount: number;
contentType: string | null; currency: string;
} }
export interface ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_selectionAttributes_values { export interface ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_channelListings {
__typename: "AttributeValue"; __typename: "ProductVariantChannelListing";
id: string; channel: ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_channelListings_channel;
name: string | null; price: ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_channelListings_price | null;
slug: string | null; costPrice: ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_channelListings_costPrice | null;
file: ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_selectionAttributes_values_file | null;
reference: string | null;
richText: any | null;
}
export interface ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_selectionAttributes {
__typename: "SelectedAttribute";
attribute: ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_selectionAttributes_attribute;
values: (ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_selectionAttributes_values | null)[];
}
export interface ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_nonSelectionAttributes_attribute_values_file {
__typename: "File";
url: string;
contentType: string | null;
}
export interface ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_nonSelectionAttributes_attribute_values {
__typename: "AttributeValue";
id: string;
name: string | null;
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 {
__typename: "Attribute";
id: string;
name: string | null;
slug: string | null;
inputType: AttributeInputTypeEnum | null;
entityType: AttributeEntityTypeEnum | null;
valueRequired: boolean;
unit: MeasurementUnitsEnum | null;
values: (ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_nonSelectionAttributes_attribute_values | null)[] | null;
}
export interface ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_nonSelectionAttributes_values_file {
__typename: "File";
url: string;
contentType: string | null;
}
export interface ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_nonSelectionAttributes_values {
__typename: "AttributeValue";
id: string;
name: string | null;
slug: string | null;
file: ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_nonSelectionAttributes_values_file | null;
reference: string | null;
richText: any | null;
}
export interface ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_nonSelectionAttributes {
__typename: "SelectedAttribute";
attribute: ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_nonSelectionAttributes_attribute;
values: (ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_nonSelectionAttributes_values | null)[];
}
export interface ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_media {
__typename: "ProductMedia";
id: string;
url: string;
type: ProductMediaType;
oembedData: any;
}
export interface ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_product_defaultVariant {
__typename: "ProductVariant";
id: string;
}
export interface ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_product_media {
__typename: "ProductMedia";
id: string;
alt: string;
sortOrder: number | null;
url: string;
type: ProductMediaType;
oembedData: any;
}
export interface ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_product_thumbnail {
__typename: "Image";
url: string;
} }
export interface ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_product_channelListings_channel { export interface ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_product_channelListings_channel {
@ -191,100 +77,25 @@ export interface ProductVariantChannelListingUpdate_productVariantChannelListing
export interface ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_product_channelListings { export interface ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_product_channelListings {
__typename: "ProductChannelListing"; __typename: "ProductChannelListing";
publicationDate: any | null;
isPublished: boolean; isPublished: boolean;
publicationDate: any | null;
isAvailableForPurchase: boolean | null;
availableForPurchase: any | null;
visibleInListings: boolean;
channel: ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_product_channelListings_channel; channel: ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_product_channelListings_channel;
pricing: ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_product_channelListings_pricing | null; pricing: ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_product_channelListings_pricing | null;
} }
export interface ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_product_variants_media {
__typename: "ProductMedia";
id: string;
url: string;
type: ProductMediaType;
oembedData: any;
}
export interface ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_product_variants {
__typename: "ProductVariant";
id: string;
name: string;
sku: string;
media: ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_product_variants_media[] | null;
}
export interface ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_product { export interface ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_product {
__typename: "Product"; __typename: "Product";
id: string;
defaultVariant: ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_product_defaultVariant | null;
media: ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_product_media[] | null;
name: string;
thumbnail: ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_product_thumbnail | null;
channelListings: ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_product_channelListings[] | null; channelListings: ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_product_channelListings[] | null;
variants: (ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_product_variants | null)[] | null;
}
export interface ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_channelListings_channel {
__typename: "Channel";
id: string;
name: string;
currencyCode: string;
}
export interface ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_channelListings_price {
__typename: "Money";
amount: number;
currency: string;
}
export interface ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_channelListings_costPrice {
__typename: "Money";
amount: number;
currency: string;
}
export interface ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_channelListings {
__typename: "ProductVariantChannelListing";
channel: ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_channelListings_channel;
price: ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_channelListings_price | null;
costPrice: ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_channelListings_costPrice | null;
}
export interface ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_stocks_warehouse {
__typename: "Warehouse";
id: string;
name: string;
}
export interface ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_stocks {
__typename: "Stock";
id: string;
quantity: number;
quantityAllocated: number;
warehouse: ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_stocks_warehouse;
}
export interface ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_weight {
__typename: "Weight";
unit: WeightUnitsEnum;
value: number;
} }
export interface ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant { export interface ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant {
__typename: "ProductVariant"; __typename: "ProductVariant";
id: string; id: string;
metadata: (ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_metadata | null)[];
privateMetadata: (ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_privateMetadata | null)[];
selectionAttributes: ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_selectionAttributes[];
nonSelectionAttributes: ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_nonSelectionAttributes[];
media: ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_media[] | null;
name: string;
product: ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_product;
channelListings: ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_channelListings[] | null; channelListings: ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_channelListings[] | null;
sku: string; product: ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_product;
stocks: (ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_stocks | null)[] | null;
trackInventory: boolean;
weight: ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_variant_weight | null;
} }
export interface ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_errors { export interface ProductVariantChannelListingUpdate_productVariantChannelListingUpdate_errors {

View file

@ -28,22 +28,42 @@ export interface ProductVariantCreateData_product_channelListings {
channel: ProductVariantCreateData_product_channelListings_channel; channel: ProductVariantCreateData_product_channelListings_channel;
} }
export interface ProductVariantCreateData_product_productType_selectionVariantAttributes_values_file { export interface ProductVariantCreateData_product_productType_selectionVariantAttributes_choices_pageInfo {
__typename: "PageInfo";
endCursor: string | null;
hasNextPage: boolean;
hasPreviousPage: boolean;
startCursor: string | null;
}
export interface ProductVariantCreateData_product_productType_selectionVariantAttributes_choices_edges_node_file {
__typename: "File"; __typename: "File";
url: string; url: string;
contentType: string | null; contentType: string | null;
} }
export interface ProductVariantCreateData_product_productType_selectionVariantAttributes_values { export interface ProductVariantCreateData_product_productType_selectionVariantAttributes_choices_edges_node {
__typename: "AttributeValue"; __typename: "AttributeValue";
id: string; id: string;
name: string | null; name: string | null;
slug: string | null; slug: string | null;
file: ProductVariantCreateData_product_productType_selectionVariantAttributes_values_file | null; file: ProductVariantCreateData_product_productType_selectionVariantAttributes_choices_edges_node_file | null;
reference: string | null; reference: string | null;
richText: any | null; richText: any | null;
} }
export interface ProductVariantCreateData_product_productType_selectionVariantAttributes_choices_edges {
__typename: "AttributeValueCountableEdge";
cursor: string;
node: ProductVariantCreateData_product_productType_selectionVariantAttributes_choices_edges_node;
}
export interface ProductVariantCreateData_product_productType_selectionVariantAttributes_choices {
__typename: "AttributeValueCountableConnection";
pageInfo: ProductVariantCreateData_product_productType_selectionVariantAttributes_choices_pageInfo;
edges: ProductVariantCreateData_product_productType_selectionVariantAttributes_choices_edges[];
}
export interface ProductVariantCreateData_product_productType_selectionVariantAttributes { export interface ProductVariantCreateData_product_productType_selectionVariantAttributes {
__typename: "Attribute"; __typename: "Attribute";
id: string; id: string;
@ -53,25 +73,45 @@ export interface ProductVariantCreateData_product_productType_selectionVariantAt
entityType: AttributeEntityTypeEnum | null; entityType: AttributeEntityTypeEnum | null;
valueRequired: boolean; valueRequired: boolean;
unit: MeasurementUnitsEnum | null; unit: MeasurementUnitsEnum | null;
values: (ProductVariantCreateData_product_productType_selectionVariantAttributes_values | null)[] | null; choices: ProductVariantCreateData_product_productType_selectionVariantAttributes_choices | null;
} }
export interface ProductVariantCreateData_product_productType_nonSelectionVariantAttributes_values_file { export interface ProductVariantCreateData_product_productType_nonSelectionVariantAttributes_choices_pageInfo {
__typename: "PageInfo";
endCursor: string | null;
hasNextPage: boolean;
hasPreviousPage: boolean;
startCursor: string | null;
}
export interface ProductVariantCreateData_product_productType_nonSelectionVariantAttributes_choices_edges_node_file {
__typename: "File"; __typename: "File";
url: string; url: string;
contentType: string | null; contentType: string | null;
} }
export interface ProductVariantCreateData_product_productType_nonSelectionVariantAttributes_values { export interface ProductVariantCreateData_product_productType_nonSelectionVariantAttributes_choices_edges_node {
__typename: "AttributeValue"; __typename: "AttributeValue";
id: string; id: string;
name: string | null; name: string | null;
slug: string | null; slug: string | null;
file: ProductVariantCreateData_product_productType_nonSelectionVariantAttributes_values_file | null; file: ProductVariantCreateData_product_productType_nonSelectionVariantAttributes_choices_edges_node_file | null;
reference: string | null; reference: string | null;
richText: any | null; richText: any | null;
} }
export interface ProductVariantCreateData_product_productType_nonSelectionVariantAttributes_choices_edges {
__typename: "AttributeValueCountableEdge";
cursor: string;
node: ProductVariantCreateData_product_productType_nonSelectionVariantAttributes_choices_edges_node;
}
export interface ProductVariantCreateData_product_productType_nonSelectionVariantAttributes_choices {
__typename: "AttributeValueCountableConnection";
pageInfo: ProductVariantCreateData_product_productType_nonSelectionVariantAttributes_choices_pageInfo;
edges: ProductVariantCreateData_product_productType_nonSelectionVariantAttributes_choices_edges[];
}
export interface ProductVariantCreateData_product_productType_nonSelectionVariantAttributes { export interface ProductVariantCreateData_product_productType_nonSelectionVariantAttributes {
__typename: "Attribute"; __typename: "Attribute";
id: string; id: string;
@ -81,7 +121,7 @@ export interface ProductVariantCreateData_product_productType_nonSelectionVarian
entityType: AttributeEntityTypeEnum | null; entityType: AttributeEntityTypeEnum | null;
valueRequired: boolean; valueRequired: boolean;
unit: MeasurementUnitsEnum | null; unit: MeasurementUnitsEnum | null;
values: (ProductVariantCreateData_product_productType_nonSelectionVariantAttributes_values | null)[] | null; choices: ProductVariantCreateData_product_productType_nonSelectionVariantAttributes_choices | null;
} }
export interface ProductVariantCreateData_product_productType { export interface ProductVariantCreateData_product_productType {
@ -128,4 +168,8 @@ export interface ProductVariantCreateData {
export interface ProductVariantCreateDataVariables { export interface ProductVariantCreateDataVariables {
id: string; id: string;
firstValues?: number | null;
afterValues?: string | null;
lastValues?: number | null;
beforeValues?: string | null;
} }

View file

@ -21,22 +21,42 @@ export interface ProductVariantDetails_productVariant_privateMetadata {
value: string; value: string;
} }
export interface ProductVariantDetails_productVariant_selectionAttributes_attribute_values_file { export interface ProductVariantDetails_productVariant_selectionAttributes_attribute_choices_pageInfo {
__typename: "PageInfo";
endCursor: string | null;
hasNextPage: boolean;
hasPreviousPage: boolean;
startCursor: string | null;
}
export interface ProductVariantDetails_productVariant_selectionAttributes_attribute_choices_edges_node_file {
__typename: "File"; __typename: "File";
url: string; url: string;
contentType: string | null; contentType: string | null;
} }
export interface ProductVariantDetails_productVariant_selectionAttributes_attribute_values { export interface ProductVariantDetails_productVariant_selectionAttributes_attribute_choices_edges_node {
__typename: "AttributeValue"; __typename: "AttributeValue";
id: string; id: string;
name: string | null; name: string | null;
slug: string | null; slug: string | null;
file: ProductVariantDetails_productVariant_selectionAttributes_attribute_values_file | null; file: ProductVariantDetails_productVariant_selectionAttributes_attribute_choices_edges_node_file | null;
reference: string | null; reference: string | null;
richText: any | null; richText: any | null;
} }
export interface ProductVariantDetails_productVariant_selectionAttributes_attribute_choices_edges {
__typename: "AttributeValueCountableEdge";
cursor: string;
node: ProductVariantDetails_productVariant_selectionAttributes_attribute_choices_edges_node;
}
export interface ProductVariantDetails_productVariant_selectionAttributes_attribute_choices {
__typename: "AttributeValueCountableConnection";
pageInfo: ProductVariantDetails_productVariant_selectionAttributes_attribute_choices_pageInfo;
edges: ProductVariantDetails_productVariant_selectionAttributes_attribute_choices_edges[];
}
export interface ProductVariantDetails_productVariant_selectionAttributes_attribute { export interface ProductVariantDetails_productVariant_selectionAttributes_attribute {
__typename: "Attribute"; __typename: "Attribute";
id: string; id: string;
@ -46,7 +66,7 @@ export interface ProductVariantDetails_productVariant_selectionAttributes_attrib
entityType: AttributeEntityTypeEnum | null; entityType: AttributeEntityTypeEnum | null;
valueRequired: boolean; valueRequired: boolean;
unit: MeasurementUnitsEnum | null; unit: MeasurementUnitsEnum | null;
values: (ProductVariantDetails_productVariant_selectionAttributes_attribute_values | null)[] | null; choices: ProductVariantDetails_productVariant_selectionAttributes_attribute_choices | null;
} }
export interface ProductVariantDetails_productVariant_selectionAttributes_values_file { export interface ProductVariantDetails_productVariant_selectionAttributes_values_file {
@ -71,22 +91,42 @@ export interface ProductVariantDetails_productVariant_selectionAttributes {
values: (ProductVariantDetails_productVariant_selectionAttributes_values | null)[]; values: (ProductVariantDetails_productVariant_selectionAttributes_values | null)[];
} }
export interface ProductVariantDetails_productVariant_nonSelectionAttributes_attribute_values_file { export interface ProductVariantDetails_productVariant_nonSelectionAttributes_attribute_choices_pageInfo {
__typename: "PageInfo";
endCursor: string | null;
hasNextPage: boolean;
hasPreviousPage: boolean;
startCursor: string | null;
}
export interface ProductVariantDetails_productVariant_nonSelectionAttributes_attribute_choices_edges_node_file {
__typename: "File"; __typename: "File";
url: string; url: string;
contentType: string | null; contentType: string | null;
} }
export interface ProductVariantDetails_productVariant_nonSelectionAttributes_attribute_values { export interface ProductVariantDetails_productVariant_nonSelectionAttributes_attribute_choices_edges_node {
__typename: "AttributeValue"; __typename: "AttributeValue";
id: string; id: string;
name: string | null; name: string | null;
slug: string | null; slug: string | null;
file: ProductVariantDetails_productVariant_nonSelectionAttributes_attribute_values_file | null; file: ProductVariantDetails_productVariant_nonSelectionAttributes_attribute_choices_edges_node_file | null;
reference: string | null; reference: string | null;
richText: any | null; richText: any | null;
} }
export interface ProductVariantDetails_productVariant_nonSelectionAttributes_attribute_choices_edges {
__typename: "AttributeValueCountableEdge";
cursor: string;
node: ProductVariantDetails_productVariant_nonSelectionAttributes_attribute_choices_edges_node;
}
export interface ProductVariantDetails_productVariant_nonSelectionAttributes_attribute_choices {
__typename: "AttributeValueCountableConnection";
pageInfo: ProductVariantDetails_productVariant_nonSelectionAttributes_attribute_choices_pageInfo;
edges: ProductVariantDetails_productVariant_nonSelectionAttributes_attribute_choices_edges[];
}
export interface ProductVariantDetails_productVariant_nonSelectionAttributes_attribute { export interface ProductVariantDetails_productVariant_nonSelectionAttributes_attribute {
__typename: "Attribute"; __typename: "Attribute";
id: string; id: string;
@ -96,7 +136,7 @@ export interface ProductVariantDetails_productVariant_nonSelectionAttributes_att
entityType: AttributeEntityTypeEnum | null; entityType: AttributeEntityTypeEnum | null;
valueRequired: boolean; valueRequired: boolean;
unit: MeasurementUnitsEnum | null; unit: MeasurementUnitsEnum | null;
values: (ProductVariantDetails_productVariant_nonSelectionAttributes_attribute_values | null)[] | null; choices: ProductVariantDetails_productVariant_nonSelectionAttributes_attribute_choices | null;
} }
export interface ProductVariantDetails_productVariant_nonSelectionAttributes_values_file { export interface ProductVariantDetails_productVariant_nonSelectionAttributes_values_file {
@ -293,4 +333,8 @@ export interface ProductVariantDetails {
export interface ProductVariantDetailsVariables { export interface ProductVariantDetailsVariables {
id: string; id: string;
firstValues?: number | null;
afterValues?: string | null;
lastValues?: number | null;
beforeValues?: string | null;
} }

View file

@ -3,7 +3,7 @@
// @generated // @generated
// This file was automatically generated and should not be edited. // This file was automatically generated and should not be edited.
import { ReorderInput, ProductErrorCode, AttributeInputTypeEnum, AttributeEntityTypeEnum, MeasurementUnitsEnum, ProductMediaType, WeightUnitsEnum } from "./../../types/globalTypes"; import { ReorderInput, ProductErrorCode } from "./../../types/globalTypes";
// ==================================================== // ====================================================
// GraphQL mutation operation: ProductVariantReorder // GraphQL mutation operation: ProductVariantReorder
@ -15,276 +15,15 @@ export interface ProductVariantReorder_productVariantReorder_errors {
field: string | null; field: string | null;
} }
export interface ProductVariantReorder_productVariantReorder_product_attributes_attribute_values_file {
__typename: "File";
url: string;
contentType: string | null;
}
export interface ProductVariantReorder_productVariantReorder_product_attributes_attribute_values {
__typename: "AttributeValue";
id: string;
name: string | null;
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 {
__typename: "Attribute";
id: string;
slug: string | null;
name: string | null;
inputType: AttributeInputTypeEnum | null;
entityType: AttributeEntityTypeEnum | null;
valueRequired: boolean;
unit: MeasurementUnitsEnum | null;
values: (ProductVariantReorder_productVariantReorder_product_attributes_attribute_values | null)[] | null;
}
export interface ProductVariantReorder_productVariantReorder_product_attributes_values_file {
__typename: "File";
url: string;
contentType: string | null;
}
export interface ProductVariantReorder_productVariantReorder_product_attributes_values {
__typename: "AttributeValue";
id: string;
name: string | null;
slug: string | null;
file: ProductVariantReorder_productVariantReorder_product_attributes_values_file | null;
reference: string | null;
richText: any | null;
}
export interface ProductVariantReorder_productVariantReorder_product_attributes {
__typename: "SelectedAttribute";
attribute: ProductVariantReorder_productVariantReorder_product_attributes_attribute;
values: (ProductVariantReorder_productVariantReorder_product_attributes_values | null)[];
}
export interface ProductVariantReorder_productVariantReorder_product_productType_variantAttributes_values_file {
__typename: "File";
url: string;
contentType: string | null;
}
export interface ProductVariantReorder_productVariantReorder_product_productType_variantAttributes_values {
__typename: "AttributeValue";
id: string;
name: string | null;
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 {
__typename: "Attribute";
id: string;
name: string | null;
values: (ProductVariantReorder_productVariantReorder_product_productType_variantAttributes_values | null)[] | null;
}
export interface ProductVariantReorder_productVariantReorder_product_productType_taxType {
__typename: "TaxType";
description: string | null;
taxCode: string | null;
}
export interface ProductVariantReorder_productVariantReorder_product_productType {
__typename: "ProductType";
id: string;
variantAttributes: (ProductVariantReorder_productVariantReorder_product_productType_variantAttributes | null)[] | null;
name: string;
hasVariants: boolean;
taxType: ProductVariantReorder_productVariantReorder_product_productType_taxType | null;
}
export interface ProductVariantReorder_productVariantReorder_product_channelListings_channel {
__typename: "Channel";
id: string;
name: string;
currencyCode: string;
}
export interface ProductVariantReorder_productVariantReorder_product_channelListings_pricing_priceRange_start_net {
__typename: "Money";
amount: number;
currency: string;
}
export interface ProductVariantReorder_productVariantReorder_product_channelListings_pricing_priceRange_start {
__typename: "TaxedMoney";
net: ProductVariantReorder_productVariantReorder_product_channelListings_pricing_priceRange_start_net;
}
export interface ProductVariantReorder_productVariantReorder_product_channelListings_pricing_priceRange_stop_net {
__typename: "Money";
amount: number;
currency: string;
}
export interface ProductVariantReorder_productVariantReorder_product_channelListings_pricing_priceRange_stop {
__typename: "TaxedMoney";
net: ProductVariantReorder_productVariantReorder_product_channelListings_pricing_priceRange_stop_net;
}
export interface ProductVariantReorder_productVariantReorder_product_channelListings_pricing_priceRange {
__typename: "TaxedMoneyRange";
start: ProductVariantReorder_productVariantReorder_product_channelListings_pricing_priceRange_start | null;
stop: ProductVariantReorder_productVariantReorder_product_channelListings_pricing_priceRange_stop | null;
}
export interface ProductVariantReorder_productVariantReorder_product_channelListings_pricing {
__typename: "ProductPricingInfo";
priceRange: ProductVariantReorder_productVariantReorder_product_channelListings_pricing_priceRange | null;
}
export interface ProductVariantReorder_productVariantReorder_product_channelListings {
__typename: "ProductChannelListing";
channel: ProductVariantReorder_productVariantReorder_product_channelListings_channel;
pricing: ProductVariantReorder_productVariantReorder_product_channelListings_pricing | null;
isPublished: boolean;
publicationDate: any | null;
isAvailableForPurchase: boolean | null;
availableForPurchase: any | null;
visibleInListings: boolean;
}
export interface ProductVariantReorder_productVariantReorder_product_metadata {
__typename: "MetadataItem";
key: string;
value: string;
}
export interface ProductVariantReorder_productVariantReorder_product_privateMetadata {
__typename: "MetadataItem";
key: string;
value: string;
}
export interface ProductVariantReorder_productVariantReorder_product_defaultVariant {
__typename: "ProductVariant";
id: string;
}
export interface ProductVariantReorder_productVariantReorder_product_category {
__typename: "Category";
id: string;
name: string;
}
export interface ProductVariantReorder_productVariantReorder_product_collections {
__typename: "Collection";
id: string;
name: string;
}
export interface ProductVariantReorder_productVariantReorder_product_media {
__typename: "ProductMedia";
id: string;
alt: string;
sortOrder: number | null;
url: string;
type: ProductMediaType;
oembedData: any;
}
export interface ProductVariantReorder_productVariantReorder_product_variants_media {
__typename: "ProductMedia";
url: string;
}
export interface ProductVariantReorder_productVariantReorder_product_variants_stocks_warehouse {
__typename: "Warehouse";
id: string;
name: string;
}
export interface ProductVariantReorder_productVariantReorder_product_variants_stocks {
__typename: "Stock";
id: string;
quantity: number;
quantityAllocated: number;
warehouse: ProductVariantReorder_productVariantReorder_product_variants_stocks_warehouse;
}
export interface ProductVariantReorder_productVariantReorder_product_variants_channelListings_channel {
__typename: "Channel";
id: string;
name: string;
currencyCode: string;
}
export interface ProductVariantReorder_productVariantReorder_product_variants_channelListings_price {
__typename: "Money";
amount: number;
currency: string;
}
export interface ProductVariantReorder_productVariantReorder_product_variants_channelListings_costPrice {
__typename: "Money";
amount: number;
currency: string;
}
export interface ProductVariantReorder_productVariantReorder_product_variants_channelListings {
__typename: "ProductVariantChannelListing";
channel: ProductVariantReorder_productVariantReorder_product_variants_channelListings_channel;
price: ProductVariantReorder_productVariantReorder_product_variants_channelListings_price | null;
costPrice: ProductVariantReorder_productVariantReorder_product_variants_channelListings_costPrice | null;
}
export interface ProductVariantReorder_productVariantReorder_product_variants { export interface ProductVariantReorder_productVariantReorder_product_variants {
__typename: "ProductVariant"; __typename: "ProductVariant";
id: string; id: string;
sku: string;
name: string;
margin: number | null;
media: ProductVariantReorder_productVariantReorder_product_variants_media[] | null;
stocks: (ProductVariantReorder_productVariantReorder_product_variants_stocks | null)[] | null;
trackInventory: boolean;
channelListings: ProductVariantReorder_productVariantReorder_product_variants_channelListings[] | null;
}
export interface ProductVariantReorder_productVariantReorder_product_weight {
__typename: "Weight";
unit: WeightUnitsEnum;
value: number;
}
export interface ProductVariantReorder_productVariantReorder_product_taxType {
__typename: "TaxType";
description: string | null;
taxCode: string | null;
} }
export interface ProductVariantReorder_productVariantReorder_product { export interface ProductVariantReorder_productVariantReorder_product {
__typename: "Product"; __typename: "Product";
id: string; id: string;
attributes: ProductVariantReorder_productVariantReorder_product_attributes[];
productType: ProductVariantReorder_productVariantReorder_product_productType;
channelListings: ProductVariantReorder_productVariantReorder_product_channelListings[] | null;
metadata: (ProductVariantReorder_productVariantReorder_product_metadata | null)[];
privateMetadata: (ProductVariantReorder_productVariantReorder_product_privateMetadata | null)[];
name: string;
slug: string;
description: any | null;
seoTitle: string | null;
seoDescription: string | null;
rating: number | null;
defaultVariant: ProductVariantReorder_productVariantReorder_product_defaultVariant | null;
category: ProductVariantReorder_productVariantReorder_product_category | null;
collections: (ProductVariantReorder_productVariantReorder_product_collections | null)[] | null;
chargeTaxes: boolean;
media: ProductVariantReorder_productVariantReorder_product_media[] | null;
isAvailable: boolean | null;
variants: (ProductVariantReorder_productVariantReorder_product_variants | null)[] | null; variants: (ProductVariantReorder_productVariantReorder_product_variants | null)[] | null;
weight: ProductVariantReorder_productVariantReorder_product_weight | null;
taxType: ProductVariantReorder_productVariantReorder_product_taxType | null;
} }
export interface ProductVariantReorder_productVariantReorder { export interface ProductVariantReorder_productVariantReorder {

View file

@ -3,7 +3,7 @@
// @generated // @generated
// This file was automatically generated and should not be edited. // This file was automatically generated and should not be edited.
import { ProductErrorCode, AttributeInputTypeEnum, AttributeEntityTypeEnum, MeasurementUnitsEnum, ProductMediaType, WeightUnitsEnum } from "./../../types/globalTypes"; import { ProductErrorCode } from "./../../types/globalTypes";
// ==================================================== // ====================================================
// GraphQL mutation operation: ProductVariantSetDefault // GraphQL mutation operation: ProductVariantSetDefault
@ -15,276 +15,23 @@ export interface ProductVariantSetDefault_productVariantSetDefault_errors {
field: string | null; field: string | null;
} }
export interface ProductVariantSetDefault_productVariantSetDefault_product_attributes_attribute_values_file {
__typename: "File";
url: string;
contentType: string | null;
}
export interface ProductVariantSetDefault_productVariantSetDefault_product_attributes_attribute_values {
__typename: "AttributeValue";
id: string;
name: string | null;
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 {
__typename: "Attribute";
id: string;
slug: string | null;
name: string | null;
inputType: AttributeInputTypeEnum | null;
entityType: AttributeEntityTypeEnum | null;
valueRequired: boolean;
unit: MeasurementUnitsEnum | null;
values: (ProductVariantSetDefault_productVariantSetDefault_product_attributes_attribute_values | null)[] | null;
}
export interface ProductVariantSetDefault_productVariantSetDefault_product_attributes_values_file {
__typename: "File";
url: string;
contentType: string | null;
}
export interface ProductVariantSetDefault_productVariantSetDefault_product_attributes_values {
__typename: "AttributeValue";
id: string;
name: string | null;
slug: string | null;
file: ProductVariantSetDefault_productVariantSetDefault_product_attributes_values_file | null;
reference: string | null;
richText: any | null;
}
export interface ProductVariantSetDefault_productVariantSetDefault_product_attributes {
__typename: "SelectedAttribute";
attribute: ProductVariantSetDefault_productVariantSetDefault_product_attributes_attribute;
values: (ProductVariantSetDefault_productVariantSetDefault_product_attributes_values | null)[];
}
export interface ProductVariantSetDefault_productVariantSetDefault_product_productType_variantAttributes_values_file {
__typename: "File";
url: string;
contentType: string | null;
}
export interface ProductVariantSetDefault_productVariantSetDefault_product_productType_variantAttributes_values {
__typename: "AttributeValue";
id: string;
name: string | null;
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 {
__typename: "Attribute";
id: string;
name: string | null;
values: (ProductVariantSetDefault_productVariantSetDefault_product_productType_variantAttributes_values | null)[] | null;
}
export interface ProductVariantSetDefault_productVariantSetDefault_product_productType_taxType {
__typename: "TaxType";
description: string | null;
taxCode: string | null;
}
export interface ProductVariantSetDefault_productVariantSetDefault_product_productType {
__typename: "ProductType";
id: string;
variantAttributes: (ProductVariantSetDefault_productVariantSetDefault_product_productType_variantAttributes | null)[] | null;
name: string;
hasVariants: boolean;
taxType: ProductVariantSetDefault_productVariantSetDefault_product_productType_taxType | null;
}
export interface ProductVariantSetDefault_productVariantSetDefault_product_channelListings_channel {
__typename: "Channel";
id: string;
name: string;
currencyCode: string;
}
export interface ProductVariantSetDefault_productVariantSetDefault_product_channelListings_pricing_priceRange_start_net {
__typename: "Money";
amount: number;
currency: string;
}
export interface ProductVariantSetDefault_productVariantSetDefault_product_channelListings_pricing_priceRange_start {
__typename: "TaxedMoney";
net: ProductVariantSetDefault_productVariantSetDefault_product_channelListings_pricing_priceRange_start_net;
}
export interface ProductVariantSetDefault_productVariantSetDefault_product_channelListings_pricing_priceRange_stop_net {
__typename: "Money";
amount: number;
currency: string;
}
export interface ProductVariantSetDefault_productVariantSetDefault_product_channelListings_pricing_priceRange_stop {
__typename: "TaxedMoney";
net: ProductVariantSetDefault_productVariantSetDefault_product_channelListings_pricing_priceRange_stop_net;
}
export interface ProductVariantSetDefault_productVariantSetDefault_product_channelListings_pricing_priceRange {
__typename: "TaxedMoneyRange";
start: ProductVariantSetDefault_productVariantSetDefault_product_channelListings_pricing_priceRange_start | null;
stop: ProductVariantSetDefault_productVariantSetDefault_product_channelListings_pricing_priceRange_stop | null;
}
export interface ProductVariantSetDefault_productVariantSetDefault_product_channelListings_pricing {
__typename: "ProductPricingInfo";
priceRange: ProductVariantSetDefault_productVariantSetDefault_product_channelListings_pricing_priceRange | null;
}
export interface ProductVariantSetDefault_productVariantSetDefault_product_channelListings {
__typename: "ProductChannelListing";
channel: ProductVariantSetDefault_productVariantSetDefault_product_channelListings_channel;
pricing: ProductVariantSetDefault_productVariantSetDefault_product_channelListings_pricing | null;
isPublished: boolean;
publicationDate: any | null;
isAvailableForPurchase: boolean | null;
availableForPurchase: any | null;
visibleInListings: boolean;
}
export interface ProductVariantSetDefault_productVariantSetDefault_product_metadata {
__typename: "MetadataItem";
key: string;
value: string;
}
export interface ProductVariantSetDefault_productVariantSetDefault_product_privateMetadata {
__typename: "MetadataItem";
key: string;
value: string;
}
export interface ProductVariantSetDefault_productVariantSetDefault_product_defaultVariant { export interface ProductVariantSetDefault_productVariantSetDefault_product_defaultVariant {
__typename: "ProductVariant"; __typename: "ProductVariant";
id: string; id: string;
}
export interface ProductVariantSetDefault_productVariantSetDefault_product_category {
__typename: "Category";
id: string;
name: string; name: string;
} }
export interface ProductVariantSetDefault_productVariantSetDefault_product_collections {
__typename: "Collection";
id: string;
name: string;
}
export interface ProductVariantSetDefault_productVariantSetDefault_product_media {
__typename: "ProductMedia";
id: string;
alt: string;
sortOrder: number | null;
url: string;
type: ProductMediaType;
oembedData: any;
}
export interface ProductVariantSetDefault_productVariantSetDefault_product_variants_media {
__typename: "ProductMedia";
url: string;
}
export interface ProductVariantSetDefault_productVariantSetDefault_product_variants_stocks_warehouse {
__typename: "Warehouse";
id: string;
name: string;
}
export interface ProductVariantSetDefault_productVariantSetDefault_product_variants_stocks {
__typename: "Stock";
id: string;
quantity: number;
quantityAllocated: number;
warehouse: ProductVariantSetDefault_productVariantSetDefault_product_variants_stocks_warehouse;
}
export interface ProductVariantSetDefault_productVariantSetDefault_product_variants_channelListings_channel {
__typename: "Channel";
id: string;
name: string;
currencyCode: string;
}
export interface ProductVariantSetDefault_productVariantSetDefault_product_variants_channelListings_price {
__typename: "Money";
amount: number;
currency: string;
}
export interface ProductVariantSetDefault_productVariantSetDefault_product_variants_channelListings_costPrice {
__typename: "Money";
amount: number;
currency: string;
}
export interface ProductVariantSetDefault_productVariantSetDefault_product_variants_channelListings {
__typename: "ProductVariantChannelListing";
channel: ProductVariantSetDefault_productVariantSetDefault_product_variants_channelListings_channel;
price: ProductVariantSetDefault_productVariantSetDefault_product_variants_channelListings_price | null;
costPrice: ProductVariantSetDefault_productVariantSetDefault_product_variants_channelListings_costPrice | null;
}
export interface ProductVariantSetDefault_productVariantSetDefault_product_variants { export interface ProductVariantSetDefault_productVariantSetDefault_product_variants {
__typename: "ProductVariant"; __typename: "ProductVariant";
id: string; id: string;
sku: string;
name: string; name: string;
margin: number | null;
media: ProductVariantSetDefault_productVariantSetDefault_product_variants_media[] | null;
stocks: (ProductVariantSetDefault_productVariantSetDefault_product_variants_stocks | null)[] | null;
trackInventory: boolean;
channelListings: ProductVariantSetDefault_productVariantSetDefault_product_variants_channelListings[] | null;
}
export interface ProductVariantSetDefault_productVariantSetDefault_product_weight {
__typename: "Weight";
unit: WeightUnitsEnum;
value: number;
}
export interface ProductVariantSetDefault_productVariantSetDefault_product_taxType {
__typename: "TaxType";
description: string | null;
taxCode: string | null;
} }
export interface ProductVariantSetDefault_productVariantSetDefault_product { export interface ProductVariantSetDefault_productVariantSetDefault_product {
__typename: "Product"; __typename: "Product";
id: string; id: string;
attributes: ProductVariantSetDefault_productVariantSetDefault_product_attributes[];
productType: ProductVariantSetDefault_productVariantSetDefault_product_productType;
channelListings: ProductVariantSetDefault_productVariantSetDefault_product_channelListings[] | null;
metadata: (ProductVariantSetDefault_productVariantSetDefault_product_metadata | null)[];
privateMetadata: (ProductVariantSetDefault_productVariantSetDefault_product_privateMetadata | null)[];
name: string;
slug: string;
description: any | null;
seoTitle: string | null;
seoDescription: string | null;
rating: number | null;
defaultVariant: ProductVariantSetDefault_productVariantSetDefault_product_defaultVariant | null; defaultVariant: ProductVariantSetDefault_productVariantSetDefault_product_defaultVariant | null;
category: ProductVariantSetDefault_productVariantSetDefault_product_category | null;
collections: (ProductVariantSetDefault_productVariantSetDefault_product_collections | null)[] | null;
chargeTaxes: boolean;
media: ProductVariantSetDefault_productVariantSetDefault_product_media[] | null;
isAvailable: boolean | null;
variants: (ProductVariantSetDefault_productVariantSetDefault_product_variants | null)[] | null; variants: (ProductVariantSetDefault_productVariantSetDefault_product_variants | null)[] | null;
weight: ProductVariantSetDefault_productVariantSetDefault_product_weight | null;
taxType: ProductVariantSetDefault_productVariantSetDefault_product_taxType | null;
} }
export interface ProductVariantSetDefault_productVariantSetDefault { export interface ProductVariantSetDefault_productVariantSetDefault {

View file

@ -16,22 +16,42 @@ export interface SimpleProductUpdate_productUpdate_errors {
attributes: string[] | null; attributes: string[] | null;
} }
export interface SimpleProductUpdate_productUpdate_product_attributes_attribute_values_file { export interface SimpleProductUpdate_productUpdate_product_attributes_attribute_choices_pageInfo {
__typename: "PageInfo";
endCursor: string | null;
hasNextPage: boolean;
hasPreviousPage: boolean;
startCursor: string | null;
}
export interface SimpleProductUpdate_productUpdate_product_attributes_attribute_choices_edges_node_file {
__typename: "File"; __typename: "File";
url: string; url: string;
contentType: string | null; contentType: string | null;
} }
export interface SimpleProductUpdate_productUpdate_product_attributes_attribute_values { export interface SimpleProductUpdate_productUpdate_product_attributes_attribute_choices_edges_node {
__typename: "AttributeValue"; __typename: "AttributeValue";
id: string; id: string;
name: string | null; name: string | null;
slug: string | null; slug: string | null;
file: SimpleProductUpdate_productUpdate_product_attributes_attribute_values_file | null; file: SimpleProductUpdate_productUpdate_product_attributes_attribute_choices_edges_node_file | null;
reference: string | null; reference: string | null;
richText: any | null; richText: any | null;
} }
export interface SimpleProductUpdate_productUpdate_product_attributes_attribute_choices_edges {
__typename: "AttributeValueCountableEdge";
cursor: string;
node: SimpleProductUpdate_productUpdate_product_attributes_attribute_choices_edges_node;
}
export interface SimpleProductUpdate_productUpdate_product_attributes_attribute_choices {
__typename: "AttributeValueCountableConnection";
pageInfo: SimpleProductUpdate_productUpdate_product_attributes_attribute_choices_pageInfo;
edges: SimpleProductUpdate_productUpdate_product_attributes_attribute_choices_edges[];
}
export interface SimpleProductUpdate_productUpdate_product_attributes_attribute { export interface SimpleProductUpdate_productUpdate_product_attributes_attribute {
__typename: "Attribute"; __typename: "Attribute";
id: string; id: string;
@ -41,7 +61,7 @@ export interface SimpleProductUpdate_productUpdate_product_attributes_attribute
entityType: AttributeEntityTypeEnum | null; entityType: AttributeEntityTypeEnum | null;
valueRequired: boolean; valueRequired: boolean;
unit: MeasurementUnitsEnum | null; unit: MeasurementUnitsEnum | null;
values: (SimpleProductUpdate_productUpdate_product_attributes_attribute_values | null)[] | null; choices: SimpleProductUpdate_productUpdate_product_attributes_attribute_choices | null;
} }
export interface SimpleProductUpdate_productUpdate_product_attributes_values_file { export interface SimpleProductUpdate_productUpdate_product_attributes_values_file {
@ -66,27 +86,47 @@ export interface SimpleProductUpdate_productUpdate_product_attributes {
values: (SimpleProductUpdate_productUpdate_product_attributes_values | null)[]; values: (SimpleProductUpdate_productUpdate_product_attributes_values | null)[];
} }
export interface SimpleProductUpdate_productUpdate_product_productType_variantAttributes_values_file { export interface SimpleProductUpdate_productUpdate_product_productType_variantAttributes_choices_pageInfo {
__typename: "PageInfo";
endCursor: string | null;
hasNextPage: boolean;
hasPreviousPage: boolean;
startCursor: string | null;
}
export interface SimpleProductUpdate_productUpdate_product_productType_variantAttributes_choices_edges_node_file {
__typename: "File"; __typename: "File";
url: string; url: string;
contentType: string | null; contentType: string | null;
} }
export interface SimpleProductUpdate_productUpdate_product_productType_variantAttributes_values { export interface SimpleProductUpdate_productUpdate_product_productType_variantAttributes_choices_edges_node {
__typename: "AttributeValue"; __typename: "AttributeValue";
id: string; id: string;
name: string | null; name: string | null;
slug: string | null; slug: string | null;
file: SimpleProductUpdate_productUpdate_product_productType_variantAttributes_values_file | null; file: SimpleProductUpdate_productUpdate_product_productType_variantAttributes_choices_edges_node_file | null;
reference: string | null; reference: string | null;
richText: any | null; richText: any | null;
} }
export interface SimpleProductUpdate_productUpdate_product_productType_variantAttributes_choices_edges {
__typename: "AttributeValueCountableEdge";
cursor: string;
node: SimpleProductUpdate_productUpdate_product_productType_variantAttributes_choices_edges_node;
}
export interface SimpleProductUpdate_productUpdate_product_productType_variantAttributes_choices {
__typename: "AttributeValueCountableConnection";
pageInfo: SimpleProductUpdate_productUpdate_product_productType_variantAttributes_choices_pageInfo;
edges: SimpleProductUpdate_productUpdate_product_productType_variantAttributes_choices_edges[];
}
export interface SimpleProductUpdate_productUpdate_product_productType_variantAttributes { export interface SimpleProductUpdate_productUpdate_product_productType_variantAttributes {
__typename: "Attribute"; __typename: "Attribute";
id: string; id: string;
name: string | null; name: string | null;
values: (SimpleProductUpdate_productUpdate_product_productType_variantAttributes_values | null)[] | null; choices: SimpleProductUpdate_productUpdate_product_productType_variantAttributes_choices | null;
} }
export interface SimpleProductUpdate_productUpdate_product_productType_taxType { export interface SimpleProductUpdate_productUpdate_product_productType_taxType {
@ -313,22 +353,6 @@ export interface SimpleProductUpdate_productVariantUpdate_productVariant_private
value: string; value: string;
} }
export interface SimpleProductUpdate_productVariantUpdate_productVariant_selectionAttributes_attribute_values_file {
__typename: "File";
url: string;
contentType: string | null;
}
export interface SimpleProductUpdate_productVariantUpdate_productVariant_selectionAttributes_attribute_values {
__typename: "AttributeValue";
id: string;
name: string | null;
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 { export interface SimpleProductUpdate_productVariantUpdate_productVariant_selectionAttributes_attribute {
__typename: "Attribute"; __typename: "Attribute";
id: string; id: string;
@ -338,7 +362,6 @@ export interface SimpleProductUpdate_productVariantUpdate_productVariant_selecti
entityType: AttributeEntityTypeEnum | null; entityType: AttributeEntityTypeEnum | null;
valueRequired: boolean; valueRequired: boolean;
unit: MeasurementUnitsEnum | null; unit: MeasurementUnitsEnum | null;
values: (SimpleProductUpdate_productVariantUpdate_productVariant_selectionAttributes_attribute_values | null)[] | null;
} }
export interface SimpleProductUpdate_productVariantUpdate_productVariant_selectionAttributes_values_file { export interface SimpleProductUpdate_productVariantUpdate_productVariant_selectionAttributes_values_file {
@ -363,22 +386,6 @@ export interface SimpleProductUpdate_productVariantUpdate_productVariant_selecti
values: (SimpleProductUpdate_productVariantUpdate_productVariant_selectionAttributes_values | null)[]; values: (SimpleProductUpdate_productVariantUpdate_productVariant_selectionAttributes_values | null)[];
} }
export interface SimpleProductUpdate_productVariantUpdate_productVariant_nonSelectionAttributes_attribute_values_file {
__typename: "File";
url: string;
contentType: string | null;
}
export interface SimpleProductUpdate_productVariantUpdate_productVariant_nonSelectionAttributes_attribute_values {
__typename: "AttributeValue";
id: string;
name: string | null;
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 { export interface SimpleProductUpdate_productVariantUpdate_productVariant_nonSelectionAttributes_attribute {
__typename: "Attribute"; __typename: "Attribute";
id: string; id: string;
@ -388,7 +395,6 @@ export interface SimpleProductUpdate_productVariantUpdate_productVariant_nonSele
entityType: AttributeEntityTypeEnum | null; entityType: AttributeEntityTypeEnum | null;
valueRequired: boolean; valueRequired: boolean;
unit: MeasurementUnitsEnum | null; unit: MeasurementUnitsEnum | null;
values: (SimpleProductUpdate_productVariantUpdate_productVariant_nonSelectionAttributes_attribute_values | null)[] | null;
} }
export interface SimpleProductUpdate_productVariantUpdate_productVariant_nonSelectionAttributes_values_file { export interface SimpleProductUpdate_productVariantUpdate_productVariant_nonSelectionAttributes_values_file {
@ -604,22 +610,6 @@ export interface SimpleProductUpdate_productVariantStocksCreate_productVariant_p
value: string; value: string;
} }
export interface SimpleProductUpdate_productVariantStocksCreate_productVariant_selectionAttributes_attribute_values_file {
__typename: "File";
url: string;
contentType: string | null;
}
export interface SimpleProductUpdate_productVariantStocksCreate_productVariant_selectionAttributes_attribute_values {
__typename: "AttributeValue";
id: string;
name: string | null;
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 { export interface SimpleProductUpdate_productVariantStocksCreate_productVariant_selectionAttributes_attribute {
__typename: "Attribute"; __typename: "Attribute";
id: string; id: string;
@ -629,7 +619,6 @@ export interface SimpleProductUpdate_productVariantStocksCreate_productVariant_s
entityType: AttributeEntityTypeEnum | null; entityType: AttributeEntityTypeEnum | null;
valueRequired: boolean; valueRequired: boolean;
unit: MeasurementUnitsEnum | null; unit: MeasurementUnitsEnum | null;
values: (SimpleProductUpdate_productVariantStocksCreate_productVariant_selectionAttributes_attribute_values | null)[] | null;
} }
export interface SimpleProductUpdate_productVariantStocksCreate_productVariant_selectionAttributes_values_file { export interface SimpleProductUpdate_productVariantStocksCreate_productVariant_selectionAttributes_values_file {
@ -654,22 +643,6 @@ export interface SimpleProductUpdate_productVariantStocksCreate_productVariant_s
values: (SimpleProductUpdate_productVariantStocksCreate_productVariant_selectionAttributes_values | null)[]; values: (SimpleProductUpdate_productVariantStocksCreate_productVariant_selectionAttributes_values | null)[];
} }
export interface SimpleProductUpdate_productVariantStocksCreate_productVariant_nonSelectionAttributes_attribute_values_file {
__typename: "File";
url: string;
contentType: string | null;
}
export interface SimpleProductUpdate_productVariantStocksCreate_productVariant_nonSelectionAttributes_attribute_values {
__typename: "AttributeValue";
id: string;
name: string | null;
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 { export interface SimpleProductUpdate_productVariantStocksCreate_productVariant_nonSelectionAttributes_attribute {
__typename: "Attribute"; __typename: "Attribute";
id: string; id: string;
@ -679,7 +652,6 @@ export interface SimpleProductUpdate_productVariantStocksCreate_productVariant_n
entityType: AttributeEntityTypeEnum | null; entityType: AttributeEntityTypeEnum | null;
valueRequired: boolean; valueRequired: boolean;
unit: MeasurementUnitsEnum | null; unit: MeasurementUnitsEnum | null;
values: (SimpleProductUpdate_productVariantStocksCreate_productVariant_nonSelectionAttributes_attribute_values | null)[] | null;
} }
export interface SimpleProductUpdate_productVariantStocksCreate_productVariant_nonSelectionAttributes_values_file { export interface SimpleProductUpdate_productVariantStocksCreate_productVariant_nonSelectionAttributes_values_file {
@ -894,22 +866,6 @@ export interface SimpleProductUpdate_productVariantStocksDelete_productVariant_p
value: string; value: string;
} }
export interface SimpleProductUpdate_productVariantStocksDelete_productVariant_selectionAttributes_attribute_values_file {
__typename: "File";
url: string;
contentType: string | null;
}
export interface SimpleProductUpdate_productVariantStocksDelete_productVariant_selectionAttributes_attribute_values {
__typename: "AttributeValue";
id: string;
name: string | null;
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 { export interface SimpleProductUpdate_productVariantStocksDelete_productVariant_selectionAttributes_attribute {
__typename: "Attribute"; __typename: "Attribute";
id: string; id: string;
@ -919,7 +875,6 @@ export interface SimpleProductUpdate_productVariantStocksDelete_productVariant_s
entityType: AttributeEntityTypeEnum | null; entityType: AttributeEntityTypeEnum | null;
valueRequired: boolean; valueRequired: boolean;
unit: MeasurementUnitsEnum | null; unit: MeasurementUnitsEnum | null;
values: (SimpleProductUpdate_productVariantStocksDelete_productVariant_selectionAttributes_attribute_values | null)[] | null;
} }
export interface SimpleProductUpdate_productVariantStocksDelete_productVariant_selectionAttributes_values_file { export interface SimpleProductUpdate_productVariantStocksDelete_productVariant_selectionAttributes_values_file {
@ -944,22 +899,6 @@ export interface SimpleProductUpdate_productVariantStocksDelete_productVariant_s
values: (SimpleProductUpdate_productVariantStocksDelete_productVariant_selectionAttributes_values | null)[]; values: (SimpleProductUpdate_productVariantStocksDelete_productVariant_selectionAttributes_values | null)[];
} }
export interface SimpleProductUpdate_productVariantStocksDelete_productVariant_nonSelectionAttributes_attribute_values_file {
__typename: "File";
url: string;
contentType: string | null;
}
export interface SimpleProductUpdate_productVariantStocksDelete_productVariant_nonSelectionAttributes_attribute_values {
__typename: "AttributeValue";
id: string;
name: string | null;
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 { export interface SimpleProductUpdate_productVariantStocksDelete_productVariant_nonSelectionAttributes_attribute {
__typename: "Attribute"; __typename: "Attribute";
id: string; id: string;
@ -969,7 +908,6 @@ export interface SimpleProductUpdate_productVariantStocksDelete_productVariant_n
entityType: AttributeEntityTypeEnum | null; entityType: AttributeEntityTypeEnum | null;
valueRequired: boolean; valueRequired: boolean;
unit: MeasurementUnitsEnum | null; unit: MeasurementUnitsEnum | null;
values: (SimpleProductUpdate_productVariantStocksDelete_productVariant_nonSelectionAttributes_attribute_values | null)[] | null;
} }
export interface SimpleProductUpdate_productVariantStocksDelete_productVariant_nonSelectionAttributes_values_file { export interface SimpleProductUpdate_productVariantStocksDelete_productVariant_nonSelectionAttributes_values_file {
@ -1185,22 +1123,6 @@ export interface SimpleProductUpdate_productVariantStocksUpdate_productVariant_p
value: string; value: string;
} }
export interface SimpleProductUpdate_productVariantStocksUpdate_productVariant_selectionAttributes_attribute_values_file {
__typename: "File";
url: string;
contentType: string | null;
}
export interface SimpleProductUpdate_productVariantStocksUpdate_productVariant_selectionAttributes_attribute_values {
__typename: "AttributeValue";
id: string;
name: string | null;
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 { export interface SimpleProductUpdate_productVariantStocksUpdate_productVariant_selectionAttributes_attribute {
__typename: "Attribute"; __typename: "Attribute";
id: string; id: string;
@ -1210,7 +1132,6 @@ export interface SimpleProductUpdate_productVariantStocksUpdate_productVariant_s
entityType: AttributeEntityTypeEnum | null; entityType: AttributeEntityTypeEnum | null;
valueRequired: boolean; valueRequired: boolean;
unit: MeasurementUnitsEnum | null; unit: MeasurementUnitsEnum | null;
values: (SimpleProductUpdate_productVariantStocksUpdate_productVariant_selectionAttributes_attribute_values | null)[] | null;
} }
export interface SimpleProductUpdate_productVariantStocksUpdate_productVariant_selectionAttributes_values_file { export interface SimpleProductUpdate_productVariantStocksUpdate_productVariant_selectionAttributes_values_file {
@ -1235,22 +1156,6 @@ export interface SimpleProductUpdate_productVariantStocksUpdate_productVariant_s
values: (SimpleProductUpdate_productVariantStocksUpdate_productVariant_selectionAttributes_values | null)[]; values: (SimpleProductUpdate_productVariantStocksUpdate_productVariant_selectionAttributes_values | null)[];
} }
export interface SimpleProductUpdate_productVariantStocksUpdate_productVariant_nonSelectionAttributes_attribute_values_file {
__typename: "File";
url: string;
contentType: string | null;
}
export interface SimpleProductUpdate_productVariantStocksUpdate_productVariant_nonSelectionAttributes_attribute_values {
__typename: "AttributeValue";
id: string;
name: string | null;
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 { export interface SimpleProductUpdate_productVariantStocksUpdate_productVariant_nonSelectionAttributes_attribute {
__typename: "Attribute"; __typename: "Attribute";
id: string; id: string;
@ -1260,7 +1165,6 @@ export interface SimpleProductUpdate_productVariantStocksUpdate_productVariant_n
entityType: AttributeEntityTypeEnum | null; entityType: AttributeEntityTypeEnum | null;
valueRequired: boolean; valueRequired: boolean;
unit: MeasurementUnitsEnum | null; unit: MeasurementUnitsEnum | null;
values: (SimpleProductUpdate_productVariantStocksUpdate_productVariant_nonSelectionAttributes_attribute_values | null)[] | null;
} }
export interface SimpleProductUpdate_productVariantStocksUpdate_productVariant_nonSelectionAttributes_values_file { export interface SimpleProductUpdate_productVariantStocksUpdate_productVariant_nonSelectionAttributes_values_file {
@ -1473,4 +1377,8 @@ export interface SimpleProductUpdateVariables {
addStocks: StockInput[]; addStocks: StockInput[];
deleteStocks: string[]; deleteStocks: string[];
updateStocks: StockInput[]; updateStocks: StockInput[];
firstValues?: number | null;
afterValues?: string | null;
lastValues?: number | null;
beforeValues?: string | null;
} }

View file

@ -28,22 +28,42 @@ export interface VariantCreate_productVariantCreate_productVariant_privateMetada
value: string; value: string;
} }
export interface VariantCreate_productVariantCreate_productVariant_selectionAttributes_attribute_values_file { export interface VariantCreate_productVariantCreate_productVariant_selectionAttributes_attribute_choices_pageInfo {
__typename: "PageInfo";
endCursor: string | null;
hasNextPage: boolean;
hasPreviousPage: boolean;
startCursor: string | null;
}
export interface VariantCreate_productVariantCreate_productVariant_selectionAttributes_attribute_choices_edges_node_file {
__typename: "File"; __typename: "File";
url: string; url: string;
contentType: string | null; contentType: string | null;
} }
export interface VariantCreate_productVariantCreate_productVariant_selectionAttributes_attribute_values { export interface VariantCreate_productVariantCreate_productVariant_selectionAttributes_attribute_choices_edges_node {
__typename: "AttributeValue"; __typename: "AttributeValue";
id: string; id: string;
name: string | null; name: string | null;
slug: string | null; slug: string | null;
file: VariantCreate_productVariantCreate_productVariant_selectionAttributes_attribute_values_file | null; file: VariantCreate_productVariantCreate_productVariant_selectionAttributes_attribute_choices_edges_node_file | null;
reference: string | null; reference: string | null;
richText: any | null; richText: any | null;
} }
export interface VariantCreate_productVariantCreate_productVariant_selectionAttributes_attribute_choices_edges {
__typename: "AttributeValueCountableEdge";
cursor: string;
node: VariantCreate_productVariantCreate_productVariant_selectionAttributes_attribute_choices_edges_node;
}
export interface VariantCreate_productVariantCreate_productVariant_selectionAttributes_attribute_choices {
__typename: "AttributeValueCountableConnection";
pageInfo: VariantCreate_productVariantCreate_productVariant_selectionAttributes_attribute_choices_pageInfo;
edges: VariantCreate_productVariantCreate_productVariant_selectionAttributes_attribute_choices_edges[];
}
export interface VariantCreate_productVariantCreate_productVariant_selectionAttributes_attribute { export interface VariantCreate_productVariantCreate_productVariant_selectionAttributes_attribute {
__typename: "Attribute"; __typename: "Attribute";
id: string; id: string;
@ -53,7 +73,7 @@ export interface VariantCreate_productVariantCreate_productVariant_selectionAttr
entityType: AttributeEntityTypeEnum | null; entityType: AttributeEntityTypeEnum | null;
valueRequired: boolean; valueRequired: boolean;
unit: MeasurementUnitsEnum | null; unit: MeasurementUnitsEnum | null;
values: (VariantCreate_productVariantCreate_productVariant_selectionAttributes_attribute_values | null)[] | null; choices: VariantCreate_productVariantCreate_productVariant_selectionAttributes_attribute_choices | null;
} }
export interface VariantCreate_productVariantCreate_productVariant_selectionAttributes_values_file { export interface VariantCreate_productVariantCreate_productVariant_selectionAttributes_values_file {
@ -78,22 +98,42 @@ export interface VariantCreate_productVariantCreate_productVariant_selectionAttr
values: (VariantCreate_productVariantCreate_productVariant_selectionAttributes_values | null)[]; values: (VariantCreate_productVariantCreate_productVariant_selectionAttributes_values | null)[];
} }
export interface VariantCreate_productVariantCreate_productVariant_nonSelectionAttributes_attribute_values_file { export interface VariantCreate_productVariantCreate_productVariant_nonSelectionAttributes_attribute_choices_pageInfo {
__typename: "PageInfo";
endCursor: string | null;
hasNextPage: boolean;
hasPreviousPage: boolean;
startCursor: string | null;
}
export interface VariantCreate_productVariantCreate_productVariant_nonSelectionAttributes_attribute_choices_edges_node_file {
__typename: "File"; __typename: "File";
url: string; url: string;
contentType: string | null; contentType: string | null;
} }
export interface VariantCreate_productVariantCreate_productVariant_nonSelectionAttributes_attribute_values { export interface VariantCreate_productVariantCreate_productVariant_nonSelectionAttributes_attribute_choices_edges_node {
__typename: "AttributeValue"; __typename: "AttributeValue";
id: string; id: string;
name: string | null; name: string | null;
slug: string | null; slug: string | null;
file: VariantCreate_productVariantCreate_productVariant_nonSelectionAttributes_attribute_values_file | null; file: VariantCreate_productVariantCreate_productVariant_nonSelectionAttributes_attribute_choices_edges_node_file | null;
reference: string | null; reference: string | null;
richText: any | null; richText: any | null;
} }
export interface VariantCreate_productVariantCreate_productVariant_nonSelectionAttributes_attribute_choices_edges {
__typename: "AttributeValueCountableEdge";
cursor: string;
node: VariantCreate_productVariantCreate_productVariant_nonSelectionAttributes_attribute_choices_edges_node;
}
export interface VariantCreate_productVariantCreate_productVariant_nonSelectionAttributes_attribute_choices {
__typename: "AttributeValueCountableConnection";
pageInfo: VariantCreate_productVariantCreate_productVariant_nonSelectionAttributes_attribute_choices_pageInfo;
edges: VariantCreate_productVariantCreate_productVariant_nonSelectionAttributes_attribute_choices_edges[];
}
export interface VariantCreate_productVariantCreate_productVariant_nonSelectionAttributes_attribute { export interface VariantCreate_productVariantCreate_productVariant_nonSelectionAttributes_attribute {
__typename: "Attribute"; __typename: "Attribute";
id: string; id: string;
@ -103,7 +143,7 @@ export interface VariantCreate_productVariantCreate_productVariant_nonSelectionA
entityType: AttributeEntityTypeEnum | null; entityType: AttributeEntityTypeEnum | null;
valueRequired: boolean; valueRequired: boolean;
unit: MeasurementUnitsEnum | null; unit: MeasurementUnitsEnum | null;
values: (VariantCreate_productVariantCreate_productVariant_nonSelectionAttributes_attribute_values | null)[] | null; choices: VariantCreate_productVariantCreate_productVariant_nonSelectionAttributes_attribute_choices | null;
} }
export interface VariantCreate_productVariantCreate_productVariant_nonSelectionAttributes_values_file { export interface VariantCreate_productVariantCreate_productVariant_nonSelectionAttributes_values_file {
@ -306,4 +346,8 @@ export interface VariantCreate {
export interface VariantCreateVariables { export interface VariantCreateVariables {
input: ProductVariantCreateInput; input: ProductVariantCreateInput;
firstValues?: number | null;
afterValues?: string | null;
lastValues?: number | null;
beforeValues?: string | null;
} }

Some files were not shown because too many files have changed in this diff Show more