import gql from "graphql-tag"; import { fragmentAddress } from "./address"; import { metadataFragment } from "./metadata"; import { fragmentMoney } from "./products"; export const fragmentOrderEvent = gql` fragment OrderEventFragment on OrderEvent { id amount shippingCostsIncluded date email emailType invoiceNumber discount { valueType value reason amount { amount currency } oldValueType oldValue oldAmount { amount currency } } relatedOrder { id number } message quantity transactionReference type user { id email firstName lastName } app { id name appUrl } lines { quantity itemName discount { valueType value reason amount { amount currency } oldValueType oldValue oldAmount { amount currency } } orderLine { id productName variantName } } } `; export const fragmentOrderLine = gql` fragment OrderLineFragment on OrderLine { id isShippingRequired variant { id quantityAvailable preorder { endDate } } productName productSku quantity quantityFulfilled quantityToFulfill unitDiscount { amount currency } unitDiscountValue unitDiscountReason unitDiscountType undiscountedUnitPrice { currency gross { amount currency } net { amount currency } } unitPrice { gross { amount currency } net { amount currency } } thumbnail { url } } `; export const fragmentRefundOrderLine = gql` fragment RefundOrderLineFragment on OrderLine { id productName quantity unitPrice { gross { ...Money } } thumbnail(size: 64) { url } } `; export const fulfillmentFragment = gql` ${fragmentOrderLine} fragment FulfillmentFragment on Fulfillment { id lines { id quantity orderLine { ...OrderLineFragment } } fulfillmentOrder status trackingNumber warehouse { id name } } `; export const invoiceFragment = gql` fragment InvoiceFragment on Invoice { id number createdAt url status } `; export const fragmentOrderDetails = gql` ${fragmentAddress} ${fragmentOrderEvent} ${fragmentOrderLine} ${fulfillmentFragment} ${invoiceFragment} ${metadataFragment} ${fragmentMoney} fragment OrderDetailsFragment on Order { id ...MetadataFragment billingAddress { ...AddressFragment } giftCards { events { id type orderId balance { initialBalance { ...Money } currentBalance { ...Money } oldInitialBalance { ...Money } oldCurrentBalance { ...Money } } } } isShippingRequired canFinalize created customerNote discounts { id type calculationMode: valueType value reason amount { ...Money } } events { ...OrderEventFragment } fulfillments { ...FulfillmentFragment } lines { ...OrderLineFragment } number isPaid paymentStatus shippingAddress { ...AddressFragment } deliveryMethod { __typename ... on ShippingMethod { id } ... on Warehouse { id clickAndCollectOption } } shippingMethod { id } shippingMethodName collectionPointName shippingPrice { gross { amount currency } } status subtotal { gross { ...Money } net { ...Money } } total { gross { ...Money } net { ...Money } tax { ...Money } } actions totalAuthorized { ...Money } totalCaptured { ...Money } undiscountedTotal { net { ...Money } gross { ...Money } } user { id email } userEmail availableShippingMethods { id name price { ...Money } } invoices { ...InvoiceFragment } channel { isActive id name currencyCode slug } isPaid } `; export const fragmentOrderSettings = gql` fragment OrderSettingsFragment on OrderSettings { automaticallyConfirmAllNewOrders automaticallyFulfillNonShippableGiftCard } `; export const fragmentShopOrderSettings = gql` fragment ShopOrderSettingsFragment on Shop { fulfillmentAutoApprove fulfillmentAllowUnpaid } `;