mirror of
https://github.com/vercel/commerce.git
synced 2025-06-18 21:21:21 +00:00
fix: Wishlist type
chore: exclude only node_modules from tsconfig
This commit is contained in:
parent
a0475cb183
commit
8be640e90f
28
framework/aquilacms/api/utils/parse-item.ts
Normal file
28
framework/aquilacms/api/utils/parse-item.ts
Normal file
@ -0,0 +1,28 @@
|
||||
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
|
||||
quantity?: number
|
||||
option_selections?: OptionSelections
|
||||
}
|
||||
|
||||
export const parseWishlistItem = (
|
||||
item: WishlistItemBody
|
||||
): BCWishlistItemBody => ({
|
||||
product_id: Number(item.productId),
|
||||
variant_id: Number(item.variantId),
|
||||
})
|
||||
|
||||
export const parseCartItem = (item: CartItemBody): BCCartItemBody => ({
|
||||
quantity: item.quantity,
|
||||
product_id: Number(item.productId),
|
||||
variant_id: Number(item.variantId),
|
||||
option_selections: item.optionSelections,
|
||||
})
|
@ -1,6 +1,14 @@
|
||||
import { AquilacmsConfig, getConfig } from '../api'
|
||||
|
||||
export type Wishlist = Omit<any, 'items'> & {
|
||||
type wishlist_Full = {
|
||||
id?: number
|
||||
customer_id?: number
|
||||
name?: string
|
||||
is_public?: boolean
|
||||
token?: string
|
||||
}
|
||||
|
||||
export type Wishlist = wishlist_Full & {
|
||||
items?: WishlistItem[]
|
||||
}
|
||||
|
||||
@ -13,7 +21,7 @@ export type GetCustomerWishlistResult<
|
||||
> = T
|
||||
|
||||
export type GetCustomerWishlistVariables = {
|
||||
customerId: number
|
||||
customerId: string
|
||||
}
|
||||
|
||||
async function getCustomerWishlist(opts: {
|
||||
@ -44,7 +52,7 @@ async function getCustomerWishlist({
|
||||
}): Promise<GetCustomerWishlistResult> {
|
||||
config = getConfig(config)
|
||||
|
||||
return { wishlist: [] }
|
||||
return { wishlist: {} }
|
||||
}
|
||||
|
||||
export default getCustomerWishlist
|
||||
|
@ -3,11 +3,6 @@ const commerce = require('./commerce.config.json')
|
||||
module.exports = {
|
||||
commerce,
|
||||
images: {
|
||||
domains: [
|
||||
'recdem.hosting-ns.com',
|
||||
'providers.aquila-cms.com',
|
||||
'provider-vercel.aquila-cms.com',
|
||||
'localhost',
|
||||
],
|
||||
domains: [new URL(process.env.AQUILACMS_URL).hostname],
|
||||
},
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
import type {
|
||||
GetStaticPathsContext,
|
||||
GetStaticPathsResult,
|
||||
GetStaticPropsContext,
|
||||
InferGetStaticPropsType,
|
||||
} from 'next'
|
||||
@ -41,9 +40,7 @@ export async function getStaticProps({
|
||||
}
|
||||
}
|
||||
|
||||
export async function getStaticPaths({
|
||||
locales,
|
||||
}: GetStaticPathsContext): Promise<GetStaticPathsResult> {
|
||||
export async function getStaticPaths({ locales }: GetStaticPathsContext) {
|
||||
const { pages } = await getAllPages()
|
||||
const [invalidPaths, log] = missingLocaleInPages()
|
||||
const paths = pages
|
||||
@ -56,6 +53,7 @@ export async function getStaticPaths({
|
||||
invalidPaths.push(url)
|
||||
})
|
||||
log()
|
||||
|
||||
return {
|
||||
paths,
|
||||
// Fallback shouldn't be enabled here or otherwise this route
|
||||
|
@ -27,12 +27,5 @@
|
||||
}
|
||||
},
|
||||
"include": ["next-env.d.ts", "**/*.d.ts", "**/*.ts", "**/*.tsx", "**/*.js"],
|
||||
"exclude": [
|
||||
"node_modules/*",
|
||||
"components/wishlist",
|
||||
"components/wishlist/WishlistButton",
|
||||
"components/wishlist/WishlistCard",
|
||||
"pages/api/bigcommerce/wishlist",
|
||||
"pages/wishlist"
|
||||
]
|
||||
"exclude": ["node_modules/*"]
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user