forked from crowetic/commerce
Ignore some types
This commit is contained in:
parent
e90d9a2121
commit
fc023de844
@ -26,7 +26,9 @@ const WishlistButton: FC<Props> = ({
|
|||||||
const { openModal, setModalView } = useUI()
|
const { openModal, setModalView } = useUI()
|
||||||
const [loading, setLoading] = useState(false)
|
const [loading, setLoading] = useState(false)
|
||||||
|
|
||||||
|
// @ts-ignore Wishlist is not always enabled
|
||||||
const itemInWishlist = data?.items?.find(
|
const itemInWishlist = data?.items?.find(
|
||||||
|
// @ts-ignore Wishlist is not always enabled
|
||||||
(item) =>
|
(item) =>
|
||||||
item.product_id === productId && (item.variant_id as any) === variant.id
|
item.product_id === productId && (item.variant_id as any) === variant.id
|
||||||
)
|
)
|
||||||
|
@ -22,6 +22,7 @@ const WishlistCard: FC<Props> = ({ product }) => {
|
|||||||
baseAmount: product.prices?.retailPrice?.value,
|
baseAmount: product.prices?.retailPrice?.value,
|
||||||
currencyCode: product.prices?.price?.currencyCode!,
|
currencyCode: product.prices?.price?.currencyCode!,
|
||||||
})
|
})
|
||||||
|
// @ts-ignore Wishlist is not always enabled
|
||||||
const removeItem = useRemoveItem({ wishlist: { includeProducts: true } })
|
const removeItem = useRemoveItem({ wishlist: { includeProducts: true } })
|
||||||
const [loading, setLoading] = useState(false)
|
const [loading, setLoading] = useState(false)
|
||||||
const [removing, setRemoving] = useState(false)
|
const [removing, setRemoving] = useState(false)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import type { Wishlist as BCWishlist } from '@framework/api/wishlist'
|
import type { Wishlist as BCWishlist } from '../bigcommerce/api/wishlist'
|
||||||
import type { Customer as BCCustomer } from '@framework/api/customers'
|
import type { Customer as BCCustomer } from '../bigcommerce/api/customers'
|
||||||
import type { SearchProductsData as BCSearchProductsData } from '@framework/api/catalog/products'
|
import type { SearchProductsData as BCSearchProductsData } from '../bigcommerce/api/catalog/products'
|
||||||
|
|
||||||
export type Discount = {
|
export type Discount = {
|
||||||
// The value of the discount, can be an amount or percentage
|
// The value of the discount, can be an amount or percentage
|
||||||
|
@ -4,7 +4,7 @@ import useCommerceCart, {
|
|||||||
UseCart,
|
UseCart,
|
||||||
} from '@commerce/cart/use-cart'
|
} from '@commerce/cart/use-cart'
|
||||||
|
|
||||||
import { Cart } from '@commerce/types'
|
import { Cart } from '../types'
|
||||||
import { SWRHook } from '@commerce/utils/types'
|
import { SWRHook } from '@commerce/utils/types'
|
||||||
import { checkoutCreate, checkoutToCart } from './utils'
|
import { checkoutCreate, checkoutToCart } from './utils'
|
||||||
import getCheckoutQuery from '../utils/queries/get-checkout-query'
|
import getCheckoutQuery from '../utils/queries/get-checkout-query'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Cart } from '@commerce/types'
|
import { Cart } from '../../types'
|
||||||
import { CommerceError, ValidationError } from '@commerce/utils/errors'
|
import { CommerceError, ValidationError } from '@commerce/utils/errors'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
@ -28,7 +28,8 @@ export type ShopifyProps = {
|
|||||||
export function CommerceProvider({ children, ...config }: ShopifyProps) {
|
export function CommerceProvider({ children, ...config }: ShopifyProps) {
|
||||||
return (
|
return (
|
||||||
<CoreCommerceProvider
|
<CoreCommerceProvider
|
||||||
provider={shopifyProvider}
|
// TODO: Fix this type
|
||||||
|
provider={shopifyProvider as any}
|
||||||
config={{ ...shopifyConfig, ...config }}
|
config={{ ...shopifyConfig, ...config }}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
|
@ -3,7 +3,7 @@ import { CollectionEdge } from '../schema'
|
|||||||
import getSiteCollectionsQuery from './queries/get-all-collections-query'
|
import getSiteCollectionsQuery from './queries/get-all-collections-query'
|
||||||
|
|
||||||
export type Category = {
|
export type Category = {
|
||||||
endityId: string
|
entityId: string
|
||||||
name: string
|
name: string
|
||||||
path: string
|
path: string
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
"analyze": "BUNDLE_ANALYZE=both yarn build",
|
"analyze": "BUNDLE_ANALYZE=both yarn build",
|
||||||
"prettier-fix": "prettier --write .",
|
"prettier-fix": "prettier --write .",
|
||||||
"find:unused": "next-unused",
|
"find:unused": "next-unused",
|
||||||
|
"commerce": "node scripts/commerce.js",
|
||||||
"generate": "graphql-codegen",
|
"generate": "graphql-codegen",
|
||||||
"generate:definitions": "node framework/bigcommerce/scripts/generate-definitions.js"
|
"generate:definitions": "node framework/bigcommerce/scripts/generate-definitions.js"
|
||||||
},
|
},
|
||||||
|
@ -25,7 +25,8 @@ export async function getStaticProps({
|
|||||||
const pageItem = pages.find((p) => (p.url ? getSlug(p.url) === slug : false))
|
const pageItem = pages.find((p) => (p.url ? getSlug(p.url) === slug : false))
|
||||||
const data =
|
const data =
|
||||||
pageItem &&
|
pageItem &&
|
||||||
(await getPage({ variables: { id: pageItem.id! }, config, preview }))
|
// TODO: Shopify - Fix this type
|
||||||
|
(await getPage({ variables: { id: pageItem.id! } as any, config, preview }))
|
||||||
const page = data?.page
|
const page = data?.page
|
||||||
|
|
||||||
if (!page) {
|
if (!page) {
|
||||||
|
@ -75,8 +75,10 @@ export default function Search({
|
|||||||
|
|
||||||
const { data } = useSearch({
|
const { data } = useSearch({
|
||||||
search: typeof q === 'string' ? q : '',
|
search: typeof q === 'string' ? q : '',
|
||||||
categoryId: activeCategory?.entityId,
|
// TODO: Shopify - Fix this type
|
||||||
brandId: activeBrand?.entityId,
|
categoryId: activeCategory?.entityId as any,
|
||||||
|
// TODO: Shopify - Fix this type
|
||||||
|
brandId: (activeBrand as any)?.entityId,
|
||||||
sort: typeof sort === 'string' ? sort : '',
|
sort: typeof sort === 'string' ? sort : '',
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -266,6 +268,7 @@ export default function Search({
|
|||||||
className={cn(
|
className={cn(
|
||||||
'block text-sm leading-5 text-gray-700 hover:bg-gray-100 lg:hover:bg-transparent hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900',
|
'block text-sm leading-5 text-gray-700 hover:bg-gray-100 lg:hover:bg-transparent hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900',
|
||||||
{
|
{
|
||||||
|
// @ts-ignore Shopify - Fix this types
|
||||||
underline: activeBrand?.entityId === node.entityId,
|
underline: activeBrand?.entityId === node.entityId,
|
||||||
}
|
}
|
||||||
)}
|
)}
|
||||||
|
@ -35,6 +35,7 @@ export async function getStaticProps({
|
|||||||
|
|
||||||
export default function Wishlist() {
|
export default function Wishlist() {
|
||||||
const { data: customer } = useCustomer()
|
const { data: customer } = useCustomer()
|
||||||
|
// @ts-ignore Shopify - Fix this types
|
||||||
const { data, isLoading, isEmpty } = useWishlist()
|
const { data, isLoading, isEmpty } = useWishlist()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
@ -57,6 +58,7 @@ export default function Wishlist() {
|
|||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
data &&
|
data &&
|
||||||
|
// @ts-ignore Shopify - Fix this types
|
||||||
data.items?.map((item) => (
|
data.items?.map((item) => (
|
||||||
<WishlistCard key={item.id} product={item as any} />
|
<WishlistCard key={item.id} product={item as any} />
|
||||||
))
|
))
|
||||||
|
1
scripts/commerce.js
Normal file
1
scripts/commerce.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
console.log('Hello')
|
Loading…
x
Reference in New Issue
Block a user