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} `; export const CHECKOUT_METADATA_UPDATE = gql` mutation CheckoutMetadataUpdate($checkoutId: ID!, $metadata: [MetadataInput!]!) { updateMetadata(id: $checkoutId, input: $metadata) { item { ... on Checkout { id metadata { key value } } } errors { field message code } } } `;