saleor-dashboard/src/fragments/discounts.ts
Dominik Żegleń 5b85d6c086
Use graphql-codegen (#1874)
* Use generated hooks in apps

* Remove unused files

* Use proper types in apps

* Use generated hooks in attributes

* Use generated hooks in auth module

* Use generated hooks in categories

* Use generated hooks in channels

* Use generated types in collections

* Remove legacy types from background tasks

* Use generated hooks in customers

* Use generated hooks in discounts

* Use generated hook in file upload

* Use generated types in gift cards

* Use generated types in home

* Use generated hooks in navigation

* Use generated hooks in orders

* Use generated hooks in pages

* Use generated hooks in page types

* Use generated hooks in permission groups

* Use generated hooks in plugins

* Use generated hooks in products

* Use fragment to mark product variants

* Improve code a bit

* Use generated hooks in page types

* Use generated types in searches

* Use generated hooks in shipping

* Use generated hooks in site settings

* Use generated hooks in staff members

* Use generated hooks in taxes

* Place all gql generated files in one directory

* Use generated hooks in translations

* Use global types from new generated module

* Use generated hooks in warehouses

* Use generated hooks in webhooks

* Use generated fragment types

* Unclutter types

* Remove hoc components

* Split hooks and types

* Fetch introspection file

* Delete obsolete schema file

* Fix rebase artifacts

* Fix autoreplace

* Fix auth provider tests

* Fix urls

* Remove leftover types

* Fix rebase artifacts
2022-03-09 09:56:55 +01:00

202 lines
3.5 KiB
TypeScript

import { gql } from "@apollo/client";
export const saleFragment = gql`
fragment Sale on Sale {
...Metadata
id
name
type
startDate
endDate
channelListings {
id
channel {
id
name
currencyCode
}
discountValue
currency
}
}
`;
export const saleDetailsFragment = gql`
fragment SaleDetails on Sale {
...Sale
variants(after: $after, before: $before, first: $first, last: $last) {
edges {
node {
id
name
product {
id
name
thumbnail {
url
}
productType {
id
name
}
channelListings {
...ChannelListingProductWithoutPricing
}
}
}
}
pageInfo {
...PageInfo
}
totalCount
}
products(after: $after, before: $before, first: $first, last: $last) {
edges {
node {
id
name
productType {
id
name
}
thumbnail {
url
}
channelListings {
...ChannelListingProductWithoutPricing
}
}
}
pageInfo {
...PageInfo
}
totalCount
}
categories(after: $after, before: $before, first: $first, last: $last) {
edges {
node {
id
name
products {
totalCount
}
}
}
pageInfo {
...PageInfo
}
totalCount
}
collections(after: $after, before: $before, first: $first, last: $last) {
edges {
node {
id
name
products {
totalCount
}
}
}
pageInfo {
...PageInfo
}
totalCount
}
}
`;
export const voucherFragment = gql`
fragment Voucher on Voucher {
...Metadata
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`
fragment VoucherDetails on Voucher {
...Voucher
code
usageLimit
used
applyOncePerOrder
applyOncePerCustomer
onlyForStaff
products(after: $after, before: $before, first: $first, last: $last) {
edges {
node {
id
name
productType {
id
name
}
thumbnail {
url
}
channelListings {
...ChannelListingProductWithoutPricing
}
}
}
totalCount
pageInfo {
...PageInfo
}
}
collections(after: $after, before: $before, first: $first, last: $last) {
edges {
node {
id
name
products {
totalCount
}
}
}
totalCount
pageInfo {
...PageInfo
}
}
categories(after: $after, before: $before, first: $first, last: $last) {
edges {
node {
id
name
products {
totalCount
}
}
}
totalCount
pageInfo {
...PageInfo
}
}
}
`;