2020-07-07 10:14:12 +00:00
|
|
|
import gql from "graphql-tag";
|
|
|
|
|
2020-07-13 16:51:05 +00:00
|
|
|
import { weightFragment } from "./weight";
|
|
|
|
|
2020-07-07 10:14:12 +00:00
|
|
|
export const stockFragment = gql`
|
|
|
|
fragment StockFragment on Stock {
|
|
|
|
id
|
|
|
|
quantity
|
|
|
|
quantityAllocated
|
|
|
|
warehouse {
|
|
|
|
id
|
|
|
|
name
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
export const fragmentMoney = gql`
|
|
|
|
fragment Money on Money {
|
|
|
|
amount
|
|
|
|
currency
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
export const fragmentProductImage = gql`
|
|
|
|
fragment ProductImageFragment on ProductImage {
|
|
|
|
id
|
|
|
|
alt
|
|
|
|
sortOrder
|
|
|
|
url
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
export const productFragment = gql`
|
|
|
|
fragment ProductFragment on Product {
|
|
|
|
id
|
|
|
|
name
|
|
|
|
thumbnail {
|
|
|
|
url
|
|
|
|
}
|
|
|
|
isAvailable
|
|
|
|
isPublished
|
|
|
|
productType {
|
|
|
|
id
|
|
|
|
name
|
|
|
|
hasVariants
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
export const productVariantAttributesFragment = gql`
|
|
|
|
${fragmentMoney}
|
|
|
|
fragment ProductVariantAttributesFragment on Product {
|
|
|
|
id
|
|
|
|
attributes {
|
|
|
|
attribute {
|
|
|
|
id
|
|
|
|
slug
|
|
|
|
name
|
|
|
|
inputType
|
|
|
|
valueRequired
|
|
|
|
values {
|
|
|
|
id
|
|
|
|
name
|
|
|
|
slug
|
|
|
|
}
|
|
|
|
}
|
|
|
|
values {
|
|
|
|
id
|
|
|
|
name
|
|
|
|
slug
|
|
|
|
}
|
|
|
|
}
|
|
|
|
productType {
|
|
|
|
id
|
|
|
|
variantAttributes {
|
|
|
|
id
|
|
|
|
name
|
|
|
|
values {
|
|
|
|
id
|
|
|
|
name
|
|
|
|
slug
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pricing {
|
|
|
|
priceRangeUndiscounted {
|
|
|
|
start {
|
|
|
|
gross {
|
|
|
|
...Money
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stop {
|
|
|
|
gross {
|
|
|
|
...Money
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
export const productFragmentDetails = gql`
|
|
|
|
${fragmentProductImage}
|
|
|
|
${fragmentMoney}
|
|
|
|
${productVariantAttributesFragment}
|
|
|
|
${stockFragment}
|
2020-07-13 16:51:05 +00:00
|
|
|
${weightFragment}
|
2020-07-07 10:14:12 +00:00
|
|
|
fragment Product on Product {
|
|
|
|
...ProductVariantAttributesFragment
|
|
|
|
name
|
|
|
|
descriptionJson
|
|
|
|
seoTitle
|
|
|
|
seoDescription
|
|
|
|
category {
|
|
|
|
id
|
|
|
|
name
|
|
|
|
}
|
|
|
|
collections {
|
|
|
|
id
|
|
|
|
name
|
|
|
|
}
|
|
|
|
margin {
|
|
|
|
start
|
|
|
|
stop
|
|
|
|
}
|
|
|
|
purchaseCost {
|
|
|
|
start {
|
|
|
|
...Money
|
|
|
|
}
|
|
|
|
stop {
|
|
|
|
...Money
|
|
|
|
}
|
|
|
|
}
|
|
|
|
isAvailable
|
|
|
|
isPublished
|
|
|
|
chargeTaxes
|
|
|
|
publicationDate
|
|
|
|
pricing {
|
|
|
|
priceRangeUndiscounted {
|
|
|
|
start {
|
|
|
|
gross {
|
|
|
|
...Money
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stop {
|
|
|
|
gross {
|
|
|
|
...Money
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
images {
|
|
|
|
...ProductImageFragment
|
|
|
|
}
|
|
|
|
variants {
|
|
|
|
id
|
|
|
|
sku
|
|
|
|
name
|
|
|
|
price {
|
|
|
|
...Money
|
|
|
|
}
|
|
|
|
margin
|
|
|
|
stocks {
|
|
|
|
...StockFragment
|
|
|
|
}
|
|
|
|
trackInventory
|
|
|
|
}
|
|
|
|
productType {
|
|
|
|
id
|
|
|
|
name
|
|
|
|
hasVariants
|
|
|
|
}
|
2020-07-13 16:51:05 +00:00
|
|
|
weight {
|
|
|
|
...WeightFragment
|
|
|
|
}
|
2020-07-07 10:14:12 +00:00
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
export const fragmentVariant = gql`
|
|
|
|
${fragmentMoney}
|
|
|
|
${fragmentProductImage}
|
|
|
|
${stockFragment}
|
2020-07-13 16:51:05 +00:00
|
|
|
${weightFragment}
|
2020-07-07 10:14:12 +00:00
|
|
|
fragment ProductVariant on ProductVariant {
|
|
|
|
id
|
|
|
|
attributes {
|
|
|
|
attribute {
|
|
|
|
id
|
|
|
|
name
|
|
|
|
slug
|
|
|
|
valueRequired
|
|
|
|
values {
|
|
|
|
id
|
|
|
|
name
|
|
|
|
slug
|
|
|
|
}
|
|
|
|
}
|
|
|
|
values {
|
|
|
|
id
|
|
|
|
name
|
|
|
|
slug
|
|
|
|
}
|
|
|
|
}
|
|
|
|
costPrice {
|
|
|
|
...Money
|
|
|
|
}
|
|
|
|
images {
|
|
|
|
id
|
|
|
|
url
|
|
|
|
}
|
|
|
|
name
|
|
|
|
price {
|
|
|
|
...Money
|
|
|
|
}
|
|
|
|
product {
|
|
|
|
id
|
|
|
|
images {
|
|
|
|
...ProductImageFragment
|
|
|
|
}
|
|
|
|
name
|
|
|
|
thumbnail {
|
|
|
|
url
|
|
|
|
}
|
|
|
|
variants {
|
|
|
|
id
|
|
|
|
name
|
|
|
|
sku
|
|
|
|
images {
|
|
|
|
id
|
|
|
|
url
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sku
|
|
|
|
stocks {
|
|
|
|
...StockFragment
|
|
|
|
}
|
|
|
|
trackInventory
|
2020-07-13 16:51:05 +00:00
|
|
|
weight {
|
|
|
|
...WeightFragment
|
|
|
|
}
|
2020-07-07 10:14:12 +00:00
|
|
|
}
|
|
|
|
`;
|