mirror of
https://github.com/vercel/commerce.git
synced 2025-05-19 07:56:59 +00:00
fix: merge conflicts
This commit is contained in:
commit
a0f4ab6ac8
@ -18,7 +18,8 @@ if (!API_URL) {
|
|||||||
|
|
||||||
import fetchGraphqlApi from './utils/fetch-graphql-api'
|
import fetchGraphqlApi from './utils/fetch-graphql-api'
|
||||||
|
|
||||||
export interface ReactionCommerceConfig extends Partial<CommerceAPIConfig> {
|
export interface ReactionCommerceConfig
|
||||||
|
extends Omit<CommerceAPIConfig, 'apiToken'> {
|
||||||
shopId: string
|
shopId: string
|
||||||
cartIdCookie: string
|
cartIdCookie: string
|
||||||
dummyEmptyCartId?: string
|
dummyEmptyCartId?: string
|
||||||
|
@ -8,18 +8,24 @@ import {
|
|||||||
} from '@commerce'
|
} from '@commerce'
|
||||||
|
|
||||||
import { reactionCommerceProvider, ReactionCommerceProvider } from './provider'
|
import { reactionCommerceProvider, ReactionCommerceProvider } from './provider'
|
||||||
import { REACTION_ANONYMOUS_CART_TOKEN_COOKIE, SHOP_ID } from './const'
|
import {
|
||||||
|
REACTION_ANONYMOUS_CART_TOKEN_COOKIE,
|
||||||
|
SHOP_ID,
|
||||||
|
REACTION_CART_ID_COOKIE,
|
||||||
|
} from './const'
|
||||||
|
|
||||||
export { reactionCommerceProvider }
|
export { reactionCommerceProvider }
|
||||||
export type { ReactionCommerceProvider }
|
export type { ReactionCommerceProvider }
|
||||||
|
|
||||||
type ReactionConfig = CommerceConfig & {
|
type ReactionConfig = CommerceConfig & {
|
||||||
shopId: string
|
shopId: string
|
||||||
|
anonymousCartTokenCookie: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export const reactionCommerceConfig: ReactionConfig = {
|
export const reactionCommerceConfig: ReactionConfig = {
|
||||||
locale: 'en-us',
|
locale: 'en-us',
|
||||||
anonymousCartTokenCookie: REACTION_ANONYMOUS_CART_TOKEN_COOKIE,
|
anonymousCartTokenCookie: REACTION_ANONYMOUS_CART_TOKEN_COOKIE,
|
||||||
|
cartCookie: REACTION_CART_ID_COOKIE,
|
||||||
shopId: SHOP_ID,
|
shopId: SHOP_ID,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
import { GraphQLFetcherResult } from '@commerce/api'
|
import { GraphQLFetcherResult } from '@commerce/api'
|
||||||
import { getConfig, ReactionCommerceConfig } from '../api'
|
import { getConfig, ReactionCommerceConfig } from '../api'
|
||||||
import { CatalogItemEdge, CatalogItemProduct } from '../schema'
|
import { CatalogItemEdge, CatalogItemProduct } from '../schema'
|
||||||
import { catalogItemsQuery } from '../utils/queries'
|
import { catalogItemsQuery, normalizeProduct } from '../utils'
|
||||||
import { normalizeProduct } from '../utils/normalize'
|
|
||||||
import { Product } from '@commerce/types'
|
import { Product } from '@commerce/types'
|
||||||
|
|
||||||
type Variables = {
|
type Variables = {
|
||||||
@ -11,7 +10,7 @@ type Variables = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ReturnType = {
|
type ReturnType = {
|
||||||
products: CatalogItemConnection[]
|
products: Product[]
|
||||||
}
|
}
|
||||||
|
|
||||||
const getAllProducts = async (options: {
|
const getAllProducts = async (options: {
|
||||||
|
@ -2,7 +2,7 @@ import {
|
|||||||
cartPayloadFragment,
|
cartPayloadFragment,
|
||||||
incorrectPriceFailureDetailsFragment,
|
incorrectPriceFailureDetailsFragment,
|
||||||
minOrderQuantityFailureDetailsFragment,
|
minOrderQuantityFailureDetailsFragment,
|
||||||
} from '@framework/utils/queries/get-checkout-query'
|
} from '@framework/utils/queries/get-cart-query'
|
||||||
|
|
||||||
const addCartItemsMutation = `
|
const addCartItemsMutation = `
|
||||||
mutation addCartItemsMutation($input: AddCartItemsInput!) {
|
mutation addCartItemsMutation($input: AddCartItemsInput!) {
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
const associateCustomerWithCheckoutMutation = /* GraphQl */ `
|
|
||||||
mutation associateCustomerWithCheckout($checkoutId: ID!, $customerAccessToken: String!) {
|
|
||||||
checkoutCustomerAssociateV2(checkoutId: $checkoutId, customerAccessToken: $customerAccessToken) {
|
|
||||||
checkout {
|
|
||||||
id
|
|
||||||
}
|
|
||||||
checkoutUserErrors {
|
|
||||||
code
|
|
||||||
field
|
|
||||||
message
|
|
||||||
}
|
|
||||||
customer {
|
|
||||||
id
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
export default associateCustomerWithCheckoutMutation
|
|
@ -2,7 +2,7 @@ import {
|
|||||||
cartPayloadFragment,
|
cartPayloadFragment,
|
||||||
incorrectPriceFailureDetailsFragment,
|
incorrectPriceFailureDetailsFragment,
|
||||||
minOrderQuantityFailureDetailsFragment,
|
minOrderQuantityFailureDetailsFragment,
|
||||||
} from '@framework/utils/queries/get-checkout-query'
|
} from '@framework/utils/queries/get-cart-query'
|
||||||
|
|
||||||
const createCartMutation = /* GraphQL */ `
|
const createCartMutation = /* GraphQL */ `
|
||||||
mutation createCartMutation($input: CreateCartInput!) {
|
mutation createCartMutation($input: CreateCartInput!) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { cartPayloadFragment } from '@framework/utils/queries/get-checkout-query'
|
import { cartPayloadFragment } from '@framework/utils/queries/get-cart-query'
|
||||||
|
|
||||||
const reconcileCartsMutation = `
|
const reconcileCartsMutation = `
|
||||||
mutation reconcileCartsMutation($input: ReconcileCartsInput!) {
|
mutation reconcileCartsMutation($input: ReconcileCartsInput!) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { cartPayloadFragment } from '@framework/utils/queries/get-checkout-query'
|
import { cartPayloadFragment } from '@framework/utils/queries/get-cart-query'
|
||||||
|
|
||||||
const updateCartItemsQuantityMutation = `
|
const updateCartItemsQuantityMutation = `
|
||||||
mutation removeCartItemsMutation($input: RemoveCartItemsInput!) {
|
mutation removeCartItemsMutation($input: RemoveCartItemsInput!) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { cartPayloadFragment } from '@framework/utils/queries/get-checkout-query'
|
import { cartPayloadFragment } from '@framework/utils/queries/get-cart-query'
|
||||||
|
|
||||||
const updateCartItemsQuantityMutation = `
|
const updateCartItemsQuantityMutation = `
|
||||||
mutation UpdateCartItemsQuantity($updateCartItemsQuantityInput: UpdateCartItemsQuantityInput!) {
|
mutation UpdateCartItemsQuantity($updateCartItemsQuantityInput: UpdateCartItemsQuantityInput!) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { cartQueryFragment } from '@framework/utils/queries/get-checkout-query'
|
import { cartQueryFragment } from '@framework/utils/queries/get-cart-query'
|
||||||
|
|
||||||
const accountCartByAccountIdQuery = `
|
const accountCartByAccountIdQuery = `
|
||||||
query accountCartByAccountIdQuery($accountId: ID!, $shopId: ID!, $itemsAfterCursor: ConnectionCursor) {
|
query accountCartByAccountIdQuery($accountId: ID!, $shopId: ID!, $itemsAfterCursor: ConnectionCursor) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { cartQueryFragment } from '../queries/get-checkout-query'
|
import { cartQueryFragment } from './get-cart-query'
|
||||||
|
|
||||||
export const getAnomymousCart = `
|
export const getAnomymousCart = `
|
||||||
query anonymousCartByCartIdQuery($cartId: ID!, $cartToken: String!, $itemsAfterCursor: ConnectionCursor) {
|
query anonymousCartByCartIdQuery($cartId: ID!, $cartToken: String!, $itemsAfterCursor: ConnectionCursor) {
|
||||||
|
@ -221,7 +221,7 @@ export const minOrderQuantityFailureDetailsFragment = `
|
|||||||
quantity
|
quantity
|
||||||
`
|
`
|
||||||
|
|
||||||
const getCheckoutQuery = /* GraphQL */ `
|
const getCartQuery = /* GraphQL */ `
|
||||||
query($checkoutId: ID!) {
|
query($checkoutId: ID!) {
|
||||||
node(id: $checkoutId) {
|
node(id: $checkoutId) {
|
||||||
... on Checkout {
|
... on Checkout {
|
||||||
@ -238,4 +238,4 @@ export const cartQueryFragment = `
|
|||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
export default getCheckoutQuery
|
export default getCartQuery
|
@ -4,7 +4,7 @@ export { default as catalogItemsQuery } from './catalog-items-query'
|
|||||||
export { default as getAllProductsPathtsQuery } from './get-all-products-paths-query'
|
export { default as getAllProductsPathtsQuery } from './get-all-products-paths-query'
|
||||||
export { default as getAllProductVendors } from './get-all-product-vendors-query'
|
export { default as getAllProductVendors } from './get-all-product-vendors-query'
|
||||||
export { default as getCollectionProductsQuery } from './get-collection-products-query'
|
export { default as getCollectionProductsQuery } from './get-collection-products-query'
|
||||||
export { default as getCheckoutQuery } from './get-checkout-query'
|
export { default as getCartQuery } from './get-cart-query'
|
||||||
export { default as getAllPagesQuery } from './get-all-pages-query'
|
export { default as getAllPagesQuery } from './get-all-pages-query'
|
||||||
export { default as getPageQuery } from './get-page-query'
|
export { default as getPageQuery } from './get-page-query'
|
||||||
export { default as viewerQuery } from './viewer-query'
|
export { default as viewerQuery } from './viewer-query'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user