diff --git a/framework/commerce/products/use-search.tsx b/framework/commerce/cart/products/use-search.tsx
similarity index 85%
rename from framework/commerce/products/use-search.tsx
rename to framework/commerce/cart/products/use-search.tsx
index 1f887f5fe..e43ca301a 100644
--- a/framework/commerce/products/use-search.tsx
+++ b/framework/commerce/cart/products/use-search.tsx
@@ -1,13 +1,13 @@
-import type { SearchProductsData } from '../types'
+import type { SearchProductsData } from '../../types'
import type {
Prop,
HookFetcherFn,
UseHookInput,
UseHookResponse,
-} from '../utils/types'
-import defaultFetcher from '../utils/default-fetcher'
-import useData from '../utils/use-data'
-import { Provider, useCommerce } from '..'
+} from '../../utils/types'
+import defaultFetcher from '../../utils/default-fetcher'
+import useData from '../../utils/use-data'
+import { Provider, useCommerce } from '../..'
import { BigcommerceProvider } from '@framework'
export type UseSearchHandler = Prop<
diff --git a/framework/commerce/config.json b/framework/commerce/config.json
new file mode 100644
index 000000000..a0e7afc5d
--- /dev/null
+++ b/framework/commerce/config.json
@@ -0,0 +1,5 @@
+{
+ "features": {
+ "wishlist": true
+ }
+}
diff --git a/framework/commerce/types.ts b/framework/commerce/types.ts
index 41aedb228..c828e74f9 100644
--- a/framework/commerce/types.ts
+++ b/framework/commerce/types.ts
@@ -148,3 +148,10 @@ export interface RemoveCartItemBody {
export interface RemoveCartItemHandlerBody extends Partial {
cartId?: string
}
+
+// Features API
+type Features = 'wishlist' | 'checkout'
+
+export interface FrameworkConfig {
+ features: Record
+}
diff --git a/pages/_app.tsx b/pages/_app.tsx
index 132ce5f18..dae0311b4 100644
--- a/pages/_app.tsx
+++ b/pages/_app.tsx
@@ -1,12 +1,11 @@
import '@assets/main.css'
-import 'keen-slider/keen-slider.min.css'
import '@assets/chrome-bug.css'
+import 'keen-slider/keen-slider.min.css'
import { FC, useEffect } from 'react'
import type { AppProps } from 'next/app'
-
-import { ManagedUIContext } from '@components/ui/context'
import { Head } from '@components/common'
+import { ManagedUIContext } from '@components/ui/context'
const Noop: FC = ({ children }) => <>{children}>
diff --git a/pages/wishlist.tsx b/pages/wishlist.tsx
index a3f25d0e7..a1dd7a5fe 100644
--- a/pages/wishlist.tsx
+++ b/pages/wishlist.tsx
@@ -1,28 +1,43 @@
+import { useEffect } from 'react'
+import { useRouter } from 'next/router'
import type { GetStaticPropsContext } from 'next'
-import { getConfig } from '@framework/api'
-import getAllPages from '@framework/common/get-all-pages'
-import useWishlist from '@framework/wishlist/use-wishlist'
-import { Layout } from '@components/common'
+
import { Heart } from '@components/icons'
+import { Layout } from '@components/common'
import { Text, Container } from '@components/ui'
-import { WishlistCard } from '@components/wishlist'
import { defaultPageProps } from '@lib/defaults'
+import { getConfig } from '@framework/api'
import { useCustomer } from '@framework/customer'
+import { WishlistCard } from '@components/wishlist'
+import useWishlist from '@framework/wishlist/use-wishlist'
+import getAllPages from '@framework/common/get-all-pages'
+import frameworkConfig from '@framework/config.json'
export async function getStaticProps({
preview,
locale,
}: GetStaticPropsContext) {
+ // Disabling page if Feature is not available
+ if (!frameworkConfig.features.wishlist) {
+ return {
+ notFound: true,
+ }
+ }
+
const config = getConfig({ locale })
const { pages } = await getAllPages({ config, preview })
return {
- props: { ...defaultPageProps, pages },
+ props: {
+ pages,
+ ...defaultPageProps,
+ },
}
}
export default function Wishlist() {
const { data: customer } = useCustomer()
const { data, isLoading, isEmpty } = useWishlist()
+ const router = useRouter()
return (