saleor-dashboard/src/fragments/discounts.ts
2021-05-06 13:43:26 +02:00

182 lines
3.3 KiB
TypeScript

import { channelListingProductWithoutPricingFragment } from "@saleor/fragments/products";
import gql from "graphql-tag";
import { pageInfoFragment } from "./pageInfo";
export const saleFragment = gql`
fragment SaleFragment on Sale {
id
name
type
startDate
endDate
channelListings {
id
channel {
id
name
currencyCode
}
discountValue
currency
}
}
`;
export const saleDetailsFragment = gql`
${channelListingProductWithoutPricingFragment}
${pageInfoFragment}
${saleFragment}
fragment SaleDetailsFragment on Sale {
...SaleFragment
products(after: $after, before: $before, first: $first, last: $last) {
edges {
node {
id
name
productType {
id
name
}
thumbnail {
url
}
channelListings {
...ChannelListingProductWithoutPricingFragment
}
}
}
pageInfo {
...PageInfoFragment
}
totalCount
}
categories(after: $after, before: $before, first: $first, last: $last) {
edges {
node {
id
name
products {
totalCount
}
}
}
pageInfo {
...PageInfoFragment
}
totalCount
}
collections(after: $after, before: $before, first: $first, last: $last) {
edges {
node {
id
name
products {
totalCount
}
}
}
pageInfo {
...PageInfoFragment
}
totalCount
}
}
`;
export const voucherFragment = gql`
fragment VoucherFragment on Voucher {
id
code
startDate
endDate
usageLimit
type
discountValueType
countries {
code
country
}
minCheckoutItemsQuantity
channelListings {
id
channel {
id
name
currencyCode
}
discountValue
currency
minSpent {
amount
currency
}
}
}
`;
export const voucherDetailsFragment = gql`
${pageInfoFragment}
${voucherFragment}
${channelListingProductWithoutPricingFragment}
fragment VoucherDetailsFragment on Voucher {
...VoucherFragment
code
usageLimit
used
applyOncePerOrder
applyOncePerCustomer
products(after: $after, before: $before, first: $first, last: $last) {
edges {
node {
id
name
productType {
id
name
}
thumbnail {
url
}
channelListings {
...ChannelListingProductWithoutPricingFragment
}
}
}
totalCount
pageInfo {
...PageInfoFragment
}
}
collections(after: $after, before: $before, first: $first, last: $last) {
edges {
node {
id
name
products {
totalCount
}
}
}
totalCount
pageInfo {
...PageInfoFragment
}
}
categories(after: $after, before: $before, first: $first, last: $last) {
edges {
node {
id
name
products {
totalCount
}
}
}
totalCount
pageInfo {
...PageInfoFragment
}
}
}
`;