
* Feed preorder data to product variant forms * Add end preorder date input and handle date data * Translate strings, refactor date parsing * Fix snapshots * CR response * CR response * CR response * Fix negative threshold, product variant preorder toggle, product variant update, and simple product creation * Make preorder data optional * Prevent setting past date as preorder end * Disable replacing preorder variant in order * Adjust fulfill view to preorder in variant * CR response + prevent subbmiting form when endPreorderDate is in the past and display warning * Add ErrorNoticeBar * Translate preorder end date in past error message, fix form submissison disabling logic * Rebase fixes * Fix preorder form disabling logic, remove isPreorder field * Fix edge cases aroud preorder inputs * Update storyshots
332 lines
5 KiB
TypeScript
332 lines
5 KiB
TypeScript
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
|
|
}
|
|
`;
|