
* Update build-types script * Remove "pricing" where it's unused; exclude pricing query if no channel is selected * Update fixtures * Fix minor preorder issue * Update types * Fix build-types script * Remove unnecessary product fragment * Fetch only data that is visible in products list (#1892) * Conditionally include attributes in product list query * Add 'hasSelectedAtrributes' variable to product list query * Refactor condition * Create AttributeValueDetailsFragment fragment * Use attributeValueDetailsFragment * Update fragment in products
79 lines
1.5 KiB
TypeScript
79 lines
1.5 KiB
TypeScript
import { gql } from "@apollo/client";
|
|
|
|
import {
|
|
attributeValueDetailsFragment,
|
|
attributeValueListFragment
|
|
} from "./attributes";
|
|
import { metadataFragment } from "./metadata";
|
|
|
|
export const pageFragment = gql`
|
|
fragment PageFragment on Page {
|
|
id
|
|
title
|
|
slug
|
|
isPublished
|
|
}
|
|
`;
|
|
|
|
export const pageAttributesFragment = gql`
|
|
${attributeValueDetailsFragment}
|
|
${attributeValueListFragment}
|
|
fragment PageAttributesFragment on Page {
|
|
attributes {
|
|
attribute {
|
|
id
|
|
slug
|
|
name
|
|
inputType
|
|
entityType
|
|
valueRequired
|
|
unit
|
|
choices(
|
|
first: $firstValues
|
|
after: $afterValues
|
|
last: $lastValues
|
|
before: $beforeValues
|
|
) {
|
|
...AttributeValueListFragment
|
|
}
|
|
}
|
|
values {
|
|
...AttributeValueDetailsFragment
|
|
}
|
|
}
|
|
pageType {
|
|
id
|
|
name
|
|
attributes {
|
|
id
|
|
name
|
|
inputType
|
|
entityType
|
|
valueRequired
|
|
choices(
|
|
first: $firstValues
|
|
after: $afterValues
|
|
last: $lastValues
|
|
before: $beforeValues
|
|
) {
|
|
...AttributeValueListFragment
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
|
|
export const pageDetailsFragment = gql`
|
|
${pageFragment}
|
|
${pageAttributesFragment}
|
|
${metadataFragment}
|
|
fragment PageDetailsFragment on Page {
|
|
...PageFragment
|
|
...PageAttributesFragment
|
|
...MetadataFragment
|
|
content
|
|
seoTitle
|
|
seoDescription
|
|
publicationDate
|
|
}
|
|
`;
|