
* 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
93 lines
2 KiB
TypeScript
93 lines
2 KiB
TypeScript
import { gql } from "@apollo/client";
|
|
|
|
export const home = gql`
|
|
query Home(
|
|
$channel: String!
|
|
$datePeriod: DateRangeInput!
|
|
$PERMISSION_MANAGE_PRODUCTS: Boolean!
|
|
$PERMISSION_MANAGE_ORDERS: Boolean!
|
|
) {
|
|
salesToday: ordersTotal(period: TODAY, channel: $channel)
|
|
@include(if: $PERMISSION_MANAGE_ORDERS) {
|
|
gross {
|
|
amount
|
|
currency
|
|
}
|
|
}
|
|
ordersToday: orders(filter: { created: $datePeriod }, channel: $channel)
|
|
@include(if: $PERMISSION_MANAGE_ORDERS) {
|
|
totalCount
|
|
}
|
|
ordersToFulfill: orders(
|
|
filter: { status: READY_TO_FULFILL }
|
|
channel: $channel
|
|
) @include(if: $PERMISSION_MANAGE_ORDERS) {
|
|
totalCount
|
|
}
|
|
ordersToCapture: orders(
|
|
filter: { status: READY_TO_CAPTURE }
|
|
channel: $channel
|
|
) @include(if: $PERMISSION_MANAGE_ORDERS) {
|
|
totalCount
|
|
}
|
|
productsOutOfStock: products(
|
|
filter: { stockAvailability: OUT_OF_STOCK }
|
|
channel: $channel
|
|
) {
|
|
totalCount
|
|
}
|
|
productTopToday: reportProductSales(
|
|
period: TODAY
|
|
first: 5
|
|
channel: $channel
|
|
) @include(if: $PERMISSION_MANAGE_PRODUCTS) {
|
|
edges {
|
|
node {
|
|
id
|
|
revenue(period: TODAY) {
|
|
gross {
|
|
amount
|
|
currency
|
|
}
|
|
}
|
|
attributes {
|
|
values {
|
|
id
|
|
name
|
|
}
|
|
}
|
|
product {
|
|
id
|
|
name
|
|
thumbnail {
|
|
url
|
|
}
|
|
}
|
|
quantityOrdered
|
|
}
|
|
}
|
|
}
|
|
activities: homepageEvents(last: 10)
|
|
@include(if: $PERMISSION_MANAGE_ORDERS) {
|
|
edges {
|
|
node {
|
|
amount
|
|
composedId
|
|
date
|
|
email
|
|
emailType
|
|
id
|
|
message
|
|
orderNumber
|
|
oversoldItems
|
|
quantity
|
|
type
|
|
user {
|
|
id
|
|
email
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`;
|