diff --git a/commerce.config.json b/commerce.config.json
index 01d7fa69e..bef7db222 100644
--- a/commerce.config.json
+++ b/commerce.config.json
@@ -1,3 +1,7 @@
{
- "provider": "shopify"
+ "provider": "bigcommerce",
+ "features": {
+ "wishlist": true,
+ "customCheckout": false
+ }
}
diff --git a/components/cart/CartSidebarView/CartSidebarView.tsx b/components/cart/CartSidebarView/CartSidebarView.tsx
index cb932247f..326390327 100644
--- a/components/cart/CartSidebarView/CartSidebarView.tsx
+++ b/components/cart/CartSidebarView/CartSidebarView.tsx
@@ -1,14 +1,14 @@
import { FC } from 'react'
import cn from 'classnames'
-import { UserNav } from '@components/common'
-import { Button } from '@components/ui'
-import { Bag, Cross, Check } from '@components/icons'
-import { useUI } from '@components/ui/context'
-import useCart from '@framework/cart/use-cart'
-import usePrice from '@framework/product/use-price'
+import Link from 'next/link'
import CartItem from '../CartItem'
import s from './CartSidebarView.module.css'
-import { LineItem } from '@commerce/types'
+import { Button } from '@components/ui'
+import { UserNav } from '@components/common'
+import { useUI } from '@components/ui/context'
+import { Bag, Cross, Check } from '@components/icons'
+import useCart from '@framework/cart/use-cart'
+import usePrice from '@framework/product/use-price'
const CartSidebarView: FC = () => {
const { closeSidebar } = useUI()
@@ -88,9 +88,14 @@ const CartSidebarView: FC = () => {
) : (
<>
-
- My Cart
-
+
+
+ My Cart
+
+
{data!.lineItems.map((item: any) => (
{
+ return (
+
+ )
+}
+
+export default CreditCard
diff --git a/components/icons/MapPin.tsx b/components/icons/MapPin.tsx
new file mode 100644
index 000000000..6323b9c1c
--- /dev/null
+++ b/components/icons/MapPin.tsx
@@ -0,0 +1,20 @@
+const MapPin = ({ ...props }) => {
+ return (
+
+ )
+}
+
+export default MapPin
diff --git a/components/icons/index.ts b/components/icons/index.ts
index 6e57ab0e8..1f2089085 100644
--- a/components/icons/index.ts
+++ b/components/icons/index.ts
@@ -14,3 +14,5 @@ export { default as RightArrow } from './RightArrow'
export { default as Info } from './Info'
export { default as ChevronUp } from './ChevronUp'
export { default as Vercel } from './Vercel'
+export { default as MapPin } from './MapPin'
+export { default as CreditCard } from './CreditCard'
diff --git a/components/ui/context.tsx b/components/ui/context.tsx
index 13992a736..f66adb9d7 100644
--- a/components/ui/context.tsx
+++ b/components/ui/context.tsx
@@ -59,7 +59,12 @@ type Action =
value: string
}
-type MODAL_VIEWS = 'SIGNUP_VIEW' | 'LOGIN_VIEW' | 'FORGOT_VIEW'
+type MODAL_VIEWS =
+ | 'SIGNUP_VIEW'
+ | 'LOGIN_VIEW'
+ | 'FORGOT_VIEW'
+ | 'NEW_SHIPPING_ADDRESS'
+ | 'NEW_PAYMENT_METHOD'
type ToastText = string
export const UIContext = React.createContext(initialState)
diff --git a/components/wishlist/WishlistButton/WishlistButton.tsx b/components/wishlist/WishlistButton/WishlistButton.tsx
index 290f7f9ec..6dc59b900 100644
--- a/components/wishlist/WishlistButton/WishlistButton.tsx
+++ b/components/wishlist/WishlistButton/WishlistButton.tsx
@@ -30,7 +30,8 @@ const WishlistButton: FC = ({
const itemInWishlist = data?.items?.find(
// @ts-ignore Wishlist is not always enabled
(item) =>
- item.product_id === productId && (item.variant_id as any) === variant.id
+ item.product_id === Number(productId) &&
+ (item.variant_id as any) === Number(variant.id)
)
const handleWishlistChange = async (e: any) => {
diff --git a/framework/bigcommerce/api/utils/parse-item.ts b/framework/bigcommerce/api/utils/parse-item.ts
index dcc716c23..7c8cd4728 100644
--- a/framework/bigcommerce/api/utils/parse-item.ts
+++ b/framework/bigcommerce/api/utils/parse-item.ts
@@ -1,6 +1,11 @@
import type { ItemBody as WishlistItemBody } from '../wishlist'
import type { CartItemBody, OptionSelections } from '../../types'
+type BCWishlistItemBody = {
+ product_id: number
+ variant_id: number
+}
+
type BCCartItemBody = {
product_id: number
variant_id: number
@@ -8,9 +13,11 @@ type BCCartItemBody = {
option_selections?: OptionSelections
}
-export const parseWishlistItem = (item: WishlistItemBody) => ({
- product_id: item.productId,
- variant_id: item.variantId,
+export const parseWishlistItem = (
+ item: WishlistItemBody
+): BCWishlistItemBody => ({
+ product_id: Number(item.productId),
+ variant_id: Number(item.variantId),
})
export const parseCartItem = (item: CartItemBody): BCCartItemBody => ({
diff --git a/framework/bigcommerce/customer/get-customer-wishlist.ts b/framework/bigcommerce/customer/get-customer-wishlist.ts
index e854ff933..97e5654a9 100644
--- a/framework/bigcommerce/customer/get-customer-wishlist.ts
+++ b/framework/bigcommerce/customer/get-customer-wishlist.ts
@@ -68,14 +68,15 @@ async function getCustomerWishlist({
const productsById = graphqlData.products.reduce<{
[k: number]: ProductEdge
}>((prods, p) => {
- prods[Number(p.node.entityId)] = p as any
+ prods[Number(p.id)] = p as any
return prods
}, {})
// Populate the wishlist items with the graphql products
wishlist.items.forEach((item) => {
const product = item && productsById[item.product_id!]
if (item && product) {
- item.product = product.node
+ // @ts-ignore Fix this type when the wishlist type is properly defined
+ item.product = product
}
})
}
diff --git a/framework/bigcommerce/wishlist/use-wishlist.tsx b/framework/bigcommerce/wishlist/use-wishlist.tsx
index 3efba7ffd..4850d1cd9 100644
--- a/framework/bigcommerce/wishlist/use-wishlist.tsx
+++ b/framework/bigcommerce/wishlist/use-wishlist.tsx
@@ -18,7 +18,7 @@ export const handler: SWRHook<
url: '/api/bigcommerce/wishlist',
method: 'GET',
},
- fetcher({ input: { customerId, includeProducts }, options, fetch }) {
+ async fetcher({ input: { customerId, includeProducts }, options, fetch }) {
if (!customerId) return null
// Use a dummy base as we only care about the relative path
@@ -35,7 +35,7 @@ export const handler: SWRHook<
const { data: customer } = useCustomer()
const response = useData({
input: [
- ['customerId', (customer as any)?.id],
+ ['customerId', customer?.entityId],
['includeProducts', input?.includeProducts],
],
swrOptions: {
diff --git a/package.json b/package.json
index 491071e55..906d950dc 100644
--- a/package.json
+++ b/package.json
@@ -8,7 +8,6 @@
"analyze": "BUNDLE_ANALYZE=both yarn build",
"prettier-fix": "prettier --write .",
"find:unused": "next-unused",
- "commerce": "node scripts/commerce.js",
"generate": "graphql-codegen",
"generate:definitions": "node framework/bigcommerce/scripts/generate-definitions.js"
},
diff --git a/pages/cart.tsx b/pages/cart.tsx
index 8b2dbb57b..cd5bedacc 100644
--- a/pages/cart.tsx
+++ b/pages/cart.tsx
@@ -5,7 +5,7 @@ import useCart from '@framework/cart/use-cart'
import usePrice from '@framework/product/use-price'
import { Layout } from '@components/common'
import { Button, Text } from '@components/ui'
-import { Bag, Cross, Check } from '@components/icons'
+import { Bag, Cross, Check, MapPin, CreditCard } from '@components/icons'
import { CartItem } from '@components/cart'
export async function getStaticProps({
@@ -38,7 +38,7 @@ export default function Cart() {
)
return (
-
+
{isLoading || isEmpty ? (
@@ -103,6 +103,35 @@ export default function Cart() {
+ {process.env.COMMERCE_CUSTOMCHECKOUT_ENABLED && (
+ <>
+ {/* Shipping Address */}
+ {/* Only available with customCheckout set to true - Meaning that the provider does offer checkout functionality. */}
+
+
+
+
+
+ + Add Shipping Address
+ {/*
+ 1046 Kearny Street.
+ San Franssisco, California
+ */}
+
+
+ {/* Payment Method */}
+ {/* Only available with customCheckout set to true - Meaning that the provider does offer checkout functionality. */}
+