Build and Deploy / build (push) Has been cancelled
- Fix checkoutLinesDelete mutation: use 'id' param and 'linesIds' instead of 'lineIds' - Fix viewport metadata warning: move to separate viewport export in layout.tsx - Add sizes prop to checkout Image with fill - Fix CartDrawer init checkout useEffect to prevent re-render loops - Various product detail improvements
155 lines
3.2 KiB
TypeScript
155 lines
3.2 KiB
TypeScript
import { gql } from "@apollo/client";
|
|
import { CHECKOUT_FRAGMENT } from "../fragments/Checkout";
|
|
|
|
export const CHECKOUT_CREATE = gql`
|
|
mutation CheckoutCreate($input: CheckoutCreateInput!) {
|
|
checkoutCreate(input: $input) {
|
|
checkout {
|
|
...CheckoutFragment
|
|
}
|
|
errors {
|
|
field
|
|
message
|
|
code
|
|
}
|
|
}
|
|
}
|
|
${CHECKOUT_FRAGMENT}
|
|
`;
|
|
|
|
export const CHECKOUT_LINES_ADD = gql`
|
|
mutation CheckoutLinesAdd($checkoutId: ID!, $lines: [CheckoutLineInput!]!) {
|
|
checkoutLinesAdd(checkoutId: $checkoutId, lines: $lines) {
|
|
checkout {
|
|
...CheckoutFragment
|
|
}
|
|
errors {
|
|
field
|
|
message
|
|
code
|
|
}
|
|
}
|
|
}
|
|
${CHECKOUT_FRAGMENT}
|
|
`;
|
|
|
|
export const CHECKOUT_LINES_UPDATE = gql`
|
|
mutation CheckoutLinesUpdate($checkoutId: ID!, $lines: [CheckoutLineUpdateInput!]!) {
|
|
checkoutLinesUpdate(checkoutId: $checkoutId, lines: $lines) {
|
|
checkout {
|
|
...CheckoutFragment
|
|
}
|
|
errors {
|
|
field
|
|
message
|
|
code
|
|
}
|
|
}
|
|
}
|
|
${CHECKOUT_FRAGMENT}
|
|
`;
|
|
|
|
export const CHECKOUT_LINES_DELETE = gql`
|
|
mutation CheckoutLinesDelete($id: ID!, $linesIds: [ID!]!) {
|
|
checkoutLinesDelete(id: $id, linesIds: $linesIds) {
|
|
checkout {
|
|
...CheckoutFragment
|
|
}
|
|
errors {
|
|
field
|
|
message
|
|
code
|
|
}
|
|
}
|
|
}
|
|
${CHECKOUT_FRAGMENT}
|
|
`;
|
|
|
|
export const CHECKOUT_SHIPPING_ADDRESS_UPDATE = gql`
|
|
mutation CheckoutShippingAddressUpdate($checkoutId: ID!, $shippingAddress: AddressInput!) {
|
|
checkoutShippingAddressUpdate(checkoutId: $checkoutId, shippingAddress: $shippingAddress) {
|
|
checkout {
|
|
...CheckoutFragment
|
|
}
|
|
errors {
|
|
field
|
|
message
|
|
code
|
|
}
|
|
}
|
|
}
|
|
${CHECKOUT_FRAGMENT}
|
|
`;
|
|
|
|
export const CHECKOUT_BILLING_ADDRESS_UPDATE = gql`
|
|
mutation CheckoutBillingAddressUpdate($checkoutId: ID!, $billingAddress: AddressInput!) {
|
|
checkoutBillingAddressUpdate(checkoutId: $checkoutId, billingAddress: $billingAddress) {
|
|
checkout {
|
|
...CheckoutFragment
|
|
}
|
|
errors {
|
|
field
|
|
message
|
|
code
|
|
}
|
|
}
|
|
}
|
|
${CHECKOUT_FRAGMENT}
|
|
`;
|
|
|
|
export const CHECKOUT_SHIPPING_METHOD_UPDATE = gql`
|
|
mutation CheckoutShippingMethodUpdate($checkoutId: ID!, $shippingMethodId: ID!) {
|
|
checkoutShippingMethodUpdate(checkoutId: $checkoutId, shippingMethodId: $shippingMethodId) {
|
|
checkout {
|
|
...CheckoutFragment
|
|
}
|
|
errors {
|
|
field
|
|
message
|
|
code
|
|
}
|
|
}
|
|
}
|
|
${CHECKOUT_FRAGMENT}
|
|
`;
|
|
|
|
export const CHECKOUT_COMPLETE = gql`
|
|
mutation CheckoutComplete($checkoutId: ID!) {
|
|
checkoutComplete(checkoutId: $checkoutId) {
|
|
order {
|
|
id
|
|
number
|
|
status
|
|
created
|
|
total {
|
|
gross {
|
|
amount
|
|
currency
|
|
}
|
|
}
|
|
}
|
|
errors {
|
|
field
|
|
message
|
|
code
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
|
|
export const CHECKOUT_EMAIL_UPDATE = gql`
|
|
mutation CheckoutEmailUpdate($checkoutId: ID!, $email: String!) {
|
|
checkoutEmailUpdate(checkoutId: $checkoutId, email: $email) {
|
|
checkout {
|
|
...CheckoutFragment
|
|
}
|
|
errors {
|
|
field
|
|
message
|
|
code
|
|
}
|
|
}
|
|
}
|
|
${CHECKOUT_FRAGMENT}
|
|
`;
|