From b1ede29576ccfffc94bd4296ba12dcb6232e5799 Mon Sep 17 00:00:00 2001 From: pfcodes Date: Thu, 23 Sep 2021 12:45:57 -0700 Subject: [PATCH 1/4] Update get-customer-wishlist.ts (#443) Closes #442 --- framework/bigcommerce/api/operations/get-customer-wishlist.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/bigcommerce/api/operations/get-customer-wishlist.ts b/framework/bigcommerce/api/operations/get-customer-wishlist.ts index fc9487ffe..5227ee663 100644 --- a/framework/bigcommerce/api/operations/get-customer-wishlist.ts +++ b/framework/bigcommerce/api/operations/get-customer-wishlist.ts @@ -53,7 +53,7 @@ export default function getCustomerWishlistOperation({ if (ids?.length) { const graphqlData = await commerce.getAllProducts({ - variables: { first: 100, ids }, + variables: { first: 50, ids }, config, }) // Put the products in an object that we can use to get them by id From 381cefae0e1b458c9e4ee61356199dc7fd097f4c Mon Sep 17 00:00:00 2001 From: Emrah <3412668+mrah@users.noreply.github.com> Date: Thu, 23 Sep 2021 23:27:46 +0300 Subject: [PATCH 2/4] fix: Remove the duplicate `description` field (#449) --- framework/vendure/utils/fragments/search-result-fragment.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/framework/vendure/utils/fragments/search-result-fragment.ts b/framework/vendure/utils/fragments/search-result-fragment.ts index 6155b5b47..e143ce20b 100644 --- a/framework/vendure/utils/fragments/search-result-fragment.ts +++ b/framework/vendure/utils/fragments/search-result-fragment.ts @@ -3,7 +3,6 @@ export const searchResultFragment = /* GraphQL */ ` productId productName description - description slug sku currencyCode From c440ff06d43f8959d46f1789c9d1d8949c566f0a Mon Sep 17 00:00:00 2001 From: Vinicius Zucatti Date: Thu, 23 Sep 2021 19:32:17 -0300 Subject: [PATCH 3/4] Fix next/link should be used with anchor as children #330 (#482) --- components/cart/CartItem/CartItem.tsx | 34 +++++++++++-------- .../cart/CartSidebarView/CartSidebarView.tsx | 8 +++-- .../CheckoutSidebarView.tsx | 4 ++- 3 files changed, 27 insertions(+), 19 deletions(-) diff --git a/components/cart/CartItem/CartItem.tsx b/components/cart/CartItem/CartItem.tsx index 4453e0c08..334761b54 100644 --- a/components/cart/CartItem/CartItem.tsx +++ b/components/cart/CartItem/CartItem.tsx @@ -85,25 +85,29 @@ const CartItem = ({
- closeSidebarIfPresent()} - className={s.productImage} - width={150} - height={150} - src={item.variant.image!.url} - alt={item.variant.image!.altText} - unoptimized - /> + + closeSidebarIfPresent()} + className={s.productImage} + width={150} + height={150} + src={item.variant.image!.url} + alt={item.variant.image!.altText} + unoptimized + /> +
- closeSidebarIfPresent()} - > - {item.name} - + + closeSidebarIfPresent()} + > + {item.name} + + {options && options.length > 0 && (
diff --git a/components/cart/CartSidebarView/CartSidebarView.tsx b/components/cart/CartSidebarView/CartSidebarView.tsx index 128b928a8..2fa7980f2 100644 --- a/components/cart/CartSidebarView/CartSidebarView.tsx +++ b/components/cart/CartSidebarView/CartSidebarView.tsx @@ -74,9 +74,11 @@ const CartSidebarView: FC = () => { <>
- - My Cart - + + + My Cart + +
    {data!.lineItems.map((item: any) => ( diff --git a/components/checkout/CheckoutSidebarView/CheckoutSidebarView.tsx b/components/checkout/CheckoutSidebarView/CheckoutSidebarView.tsx index 13a523288..9d8661bfa 100644 --- a/components/checkout/CheckoutSidebarView/CheckoutSidebarView.tsx +++ b/components/checkout/CheckoutSidebarView/CheckoutSidebarView.tsx @@ -44,7 +44,9 @@ const CheckoutSidebarView: FC = () => { >
    - Checkout + + Checkout + Date: Fri, 24 Sep 2021 13:42:09 -0300 Subject: [PATCH 4/4] Fix redirect checkout (#502) * Fix redirect checkout * Don't use checkout for saleor --- .../checkout/{submit-checkout.ts => get-checkout.ts} | 4 ++-- framework/bigcommerce/api/endpoints/checkout/index.ts | 4 ++-- framework/commerce/api/endpoints/checkout.ts | 4 ++-- framework/commerce/types/checkout.ts | 6 +++--- framework/saleor/api/endpoints/checkout/index.ts | 4 ++-- framework/saleor/commerce.config.json | 3 +-- .../checkout/{submit-checkout.ts => get-checkout.ts} | 4 ++-- framework/shopify/api/endpoints/checkout/index.ts | 4 ++-- framework/swell/api/endpoints/checkout/index.ts | 4 ++-- framework/vendure/api/endpoints/checkout/index.ts | 4 ++-- next.config.js | 2 +- 11 files changed, 21 insertions(+), 22 deletions(-) rename framework/bigcommerce/api/endpoints/checkout/{submit-checkout.ts => get-checkout.ts} (95%) rename framework/shopify/api/endpoints/checkout/{submit-checkout.ts => get-checkout.ts} (88%) diff --git a/framework/bigcommerce/api/endpoints/checkout/submit-checkout.ts b/framework/bigcommerce/api/endpoints/checkout/get-checkout.ts similarity index 95% rename from framework/bigcommerce/api/endpoints/checkout/submit-checkout.ts rename to framework/bigcommerce/api/endpoints/checkout/get-checkout.ts index 5c135df36..7b308f8e8 100644 --- a/framework/bigcommerce/api/endpoints/checkout/submit-checkout.ts +++ b/framework/bigcommerce/api/endpoints/checkout/get-checkout.ts @@ -5,7 +5,7 @@ import { uuid } from 'uuidv4' const fullCheckout = true -const submitCheckout: CheckoutEndpoint['handlers']['submitCheckout'] = async ({ +const getCheckout: CheckoutEndpoint['handlers']['getCheckout'] = async ({ req, res, config, @@ -87,4 +87,4 @@ const submitCheckout: CheckoutEndpoint['handlers']['submitCheckout'] = async ({ res.end() } -export default submitCheckout +export default getCheckout diff --git a/framework/bigcommerce/api/endpoints/checkout/index.ts b/framework/bigcommerce/api/endpoints/checkout/index.ts index 99263bdb7..9d6c548a0 100644 --- a/framework/bigcommerce/api/endpoints/checkout/index.ts +++ b/framework/bigcommerce/api/endpoints/checkout/index.ts @@ -2,13 +2,13 @@ import { GetAPISchema, createEndpoint } from '@commerce/api' import checkoutEndpoint from '@commerce/api/endpoints/checkout' import type { CheckoutSchema } from '../../../types/checkout' import type { BigcommerceAPI } from '../..' -import submitCheckout from './submit-checkout' +import getCheckout from './get-checkout' export type CheckoutAPI = GetAPISchema export type CheckoutEndpoint = CheckoutAPI['endpoint'] -export const handlers: CheckoutEndpoint['handlers'] = { submitCheckout } +export const handlers: CheckoutEndpoint['handlers'] = { getCheckout } const checkoutApi = createEndpoint({ handler: checkoutEndpoint, diff --git a/framework/commerce/api/endpoints/checkout.ts b/framework/commerce/api/endpoints/checkout.ts index b00bce284..0168e7065 100644 --- a/framework/commerce/api/endpoints/checkout.ts +++ b/framework/commerce/api/endpoints/checkout.ts @@ -26,11 +26,11 @@ const checkoutEndpoint: GetAPISchema< // Create checkout if (req.method === 'GET') { const body = { ...req.body, cartId } - return await handlers['getCheckout']?.({ ...ctx, body }) + return await handlers['getCheckout']({ ...ctx, body }) } // Create checkout - if (req.method === 'POST') { + if (req.method === 'POST' && handlers['submitCheckout']) { const body = { ...req.body, cartId } return await handlers['submitCheckout']({ ...ctx, body }) } diff --git a/framework/commerce/types/checkout.ts b/framework/commerce/types/checkout.ts index ea28926a8..58b895368 100644 --- a/framework/commerce/types/checkout.ts +++ b/framework/commerce/types/checkout.ts @@ -3,7 +3,7 @@ import type { Address } from './customer/address' import type { Card } from './customer/card' // Index -export type Checkout = unknown; +export type Checkout = any export type CheckoutTypes = { card?: Card @@ -45,8 +45,8 @@ export type SubmitCheckoutHandler = } export type CheckoutHandlers = { - getCheckout?: GetCheckoutHandler - submitCheckout: SubmitCheckoutHandler + getCheckout: GetCheckoutHandler + submitCheckout?: SubmitCheckoutHandler } export type CheckoutSchema = { diff --git a/framework/saleor/api/endpoints/checkout/index.ts b/framework/saleor/api/endpoints/checkout/index.ts index 385283ea7..2113a64d3 100644 --- a/framework/saleor/api/endpoints/checkout/index.ts +++ b/framework/saleor/api/endpoints/checkout/index.ts @@ -6,7 +6,7 @@ export type CheckoutAPI = GetAPISchema export type CheckoutEndpoint = CheckoutAPI['endpoint'] -const submitCheckout: CheckoutEndpoint['handlers']['submitCheckout'] = async ({ req, res, config }) => { +const getCheckout: CheckoutEndpoint['handlers']['getCheckout'] = async ({ req, res, config }) => { try { const html = ` @@ -43,7 +43,7 @@ const submitCheckout: CheckoutEndpoint['handlers']['submitCheckout'] = async ({ } } -export const handlers: CheckoutEndpoint['handlers'] = { submitCheckout } +export const handlers: CheckoutEndpoint['handlers'] = { getCheckout } const checkoutApi = createEndpoint({ handler: checkoutEndpoint, diff --git a/framework/saleor/commerce.config.json b/framework/saleor/commerce.config.json index d5a1ac35d..eddd3066c 100644 --- a/framework/saleor/commerce.config.json +++ b/framework/saleor/commerce.config.json @@ -1,7 +1,6 @@ { "provider": "saleor", "features": { - "wishlist": false, - "customCheckout": true + "wishlist": false } } diff --git a/framework/shopify/api/endpoints/checkout/submit-checkout.ts b/framework/shopify/api/endpoints/checkout/get-checkout.ts similarity index 88% rename from framework/shopify/api/endpoints/checkout/submit-checkout.ts rename to framework/shopify/api/endpoints/checkout/get-checkout.ts index 97ac77381..188915022 100644 --- a/framework/shopify/api/endpoints/checkout/submit-checkout.ts +++ b/framework/shopify/api/endpoints/checkout/get-checkout.ts @@ -6,7 +6,7 @@ import { import associateCustomerWithCheckoutMutation from '../../../utils/mutations/associate-customer-with-checkout' import type { CheckoutEndpoint } from '.' -const submitCheckout: CheckoutEndpoint['handlers']['submitCheckout'] = async ({ +const getCheckout: CheckoutEndpoint['handlers']['getCheckout'] = async ({ req, res, config, @@ -35,4 +35,4 @@ const submitCheckout: CheckoutEndpoint['handlers']['submitCheckout'] = async ({ } } -export default submitCheckout +export default getCheckout diff --git a/framework/shopify/api/endpoints/checkout/index.ts b/framework/shopify/api/endpoints/checkout/index.ts index 72b86cae2..863564697 100644 --- a/framework/shopify/api/endpoints/checkout/index.ts +++ b/framework/shopify/api/endpoints/checkout/index.ts @@ -2,13 +2,13 @@ import { GetAPISchema, createEndpoint } from '@commerce/api' import checkoutEndpoint from '@commerce/api/endpoints/checkout' import type { CheckoutSchema } from '../../../types/checkout' import type { ShopifyAPI } from '../..' -import submitCheckout from './submit-checkout' +import getCheckout from './get-checkout' export type CheckoutAPI = GetAPISchema export type CheckoutEndpoint = CheckoutAPI['endpoint'] -export const handlers: CheckoutEndpoint['handlers'] = { submitCheckout } +export const handlers: CheckoutEndpoint['handlers'] = { getCheckout } const checkoutApi = createEndpoint({ handler: checkoutEndpoint, diff --git a/framework/swell/api/endpoints/checkout/index.ts b/framework/swell/api/endpoints/checkout/index.ts index 9847d8420..1d521a6b6 100644 --- a/framework/swell/api/endpoints/checkout/index.ts +++ b/framework/swell/api/endpoints/checkout/index.ts @@ -3,7 +3,7 @@ import { CheckoutSchema } from '@commerce/types/checkout' import { SWELL_CHECKOUT_URL_COOKIE } from '../../../const' import checkoutEndpoint from '@commerce/api/endpoints/checkout' -const submitCheckout: CheckoutEndpoint['handlers']['submitCheckout'] = async ({ +const getCheckout: CheckoutEndpoint['handlers']['getCheckout'] = async ({ req, res, config, @@ -17,7 +17,7 @@ const submitCheckout: CheckoutEndpoint['handlers']['submitCheckout'] = async ({ res.redirect('/cart') } } -export const handlers: CheckoutEndpoint['handlers'] = { submitCheckout } +export const handlers: CheckoutEndpoint['handlers'] = { getCheckout } export type CheckoutAPI = GetAPISchema export type CheckoutEndpoint = CheckoutAPI['endpoint'] diff --git a/framework/vendure/api/endpoints/checkout/index.ts b/framework/vendure/api/endpoints/checkout/index.ts index f138af6be..7a3cd03ec 100644 --- a/framework/vendure/api/endpoints/checkout/index.ts +++ b/framework/vendure/api/endpoints/checkout/index.ts @@ -3,7 +3,7 @@ import { CommerceAPI, createEndpoint, GetAPISchema } from '@commerce/api' import { CheckoutSchema } from '@commerce/types/checkout' import checkoutEndpoint from '@commerce/api/endpoints/checkout' -const submitCheckout: CheckoutEndpoint['handlers']['submitCheckout'] = async ({ +const getCheckout: CheckoutEndpoint['handlers']['getCheckout'] = async ({ req, res, config, @@ -48,7 +48,7 @@ export type CheckoutAPI = GetAPISchema export type CheckoutEndpoint = CheckoutAPI['endpoint'] -export const handlers: CheckoutEndpoint['handlers'] = { submitCheckout } +export const handlers: CheckoutEndpoint['handlers'] = { getCheckout } const checkoutApi = createEndpoint({ handler: checkoutEndpoint, diff --git a/next.config.js b/next.config.js index 515b2ae7c..4349ba05a 100644 --- a/next.config.js +++ b/next.config.js @@ -19,7 +19,7 @@ module.exports = withCommerceConfig({ }, rewrites() { return [ - (isBC || isShopify || isSwell || isVendure) && { + (isBC || isShopify || isSwell || isVendure || isSaleor) && { source: '/checkout', destination: '/api/checkout', },