
* 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
83 lines
1.6 KiB
TypeScript
83 lines
1.6 KiB
TypeScript
import { gql } from "@apollo/client";
|
|
|
|
import { fileFragment } from "./file";
|
|
import { metadataFragment } from "./metadata";
|
|
import { pageInfoFragment } from "./pageInfo";
|
|
|
|
export const attributeValueFragment = gql`
|
|
${fileFragment}
|
|
fragment AttributeValueFragment on AttributeValue {
|
|
id
|
|
name
|
|
slug
|
|
file {
|
|
...FileFragment
|
|
}
|
|
reference
|
|
boolean
|
|
date
|
|
dateTime
|
|
value
|
|
}
|
|
`;
|
|
|
|
export const attributeValueDetailsFragment = gql`
|
|
${attributeValueFragment}
|
|
fragment AttributeValueDetailsFragment on AttributeValue {
|
|
...AttributeValueFragment
|
|
richText
|
|
}
|
|
`;
|
|
|
|
export const attributeFragment = gql`
|
|
fragment AttributeFragment on Attribute {
|
|
id
|
|
name
|
|
slug
|
|
type
|
|
visibleInStorefront
|
|
filterableInDashboard
|
|
filterableInStorefront
|
|
unit
|
|
inputType
|
|
}
|
|
`;
|
|
|
|
export const attributeDetailsFragment = gql`
|
|
${attributeFragment}
|
|
${metadataFragment}
|
|
fragment AttributeDetailsFragment on Attribute {
|
|
...AttributeFragment
|
|
...MetadataFragment
|
|
availableInGrid
|
|
inputType
|
|
entityType
|
|
unit
|
|
storefrontSearchPosition
|
|
valueRequired
|
|
}
|
|
`;
|
|
|
|
export const attributeValueListFragment = gql`
|
|
${attributeValueDetailsFragment}
|
|
${pageInfoFragment}
|
|
fragment AttributeValueListFragment on AttributeValueCountableConnection {
|
|
pageInfo {
|
|
...PageInfoFragment
|
|
}
|
|
edges {
|
|
cursor
|
|
node {
|
|
...AttributeValueDetailsFragment
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
|
|
export const availableAttributeFragment = gql`
|
|
fragment AvailableAttributeFragment on Attribute {
|
|
id
|
|
name
|
|
slug
|
|
}
|
|
`;
|