Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
647e8aa
Adding multiple initial files
lfades Mar 12, 2021
61f1292
Updated the default cart endpoint
lfades Mar 15, 2021
4afb5f5
Fixes
lfades Mar 16, 2021
21c0b7e
Updated CommerceAPI class for better usage
lfades Mar 17, 2021
90fb763
Merge branch 'master' of https://github.com/vercel/commerce into node…
lfades Mar 18, 2021
df07a55
Adding more migration changes
lfades Mar 19, 2021
149df82
Taking multiple steps into better API types
lfades Mar 20, 2021
fed3c82
Adding more experimental types
lfades Mar 20, 2021
e6df8df
Removed many testing types
lfades Mar 20, 2021
b2fbaab
Adding types, fixes and other updates
lfades Mar 26, 2021
d3fe16e
Updated commerce types
lfades Mar 26, 2021
8ad6a34
Updated types for hooks now using the API
lfades Mar 29, 2021
06dee5f
Merge branch 'master' of https://github.com/vercel/commerce into node…
lfades Mar 31, 2021
5430542
Updated mutation types
lfades Mar 31, 2021
731486e
Simplified cart types for the provider
lfades Mar 31, 2021
6d06d8b
Updated cart hooks
lfades Apr 1, 2021
c9f1398
Remove normalizers from the hooks
lfades Apr 1, 2021
779c6be
Updated cart endpoint
lfades Apr 1, 2021
519008b
Removed cart handlers
lfades Apr 1, 2021
bef5696
bug fixes
lfades Apr 2, 2021
601ec01
Improve quantity input behavior in cart item
lfades Apr 2, 2021
2281490
Removed endpoints folder
lfades Apr 2, 2021
beccca8
Making progress on api operations
lfades May 3, 2021
722f4ce
Moved method
lfades May 4, 2021
f0413fa
Moved types
lfades May 14, 2021
591cd6d
Changed the way ops are created
lfades May 14, 2021
eb2fd80
Added customer endpoint
lfades May 18, 2021
1ba6049
Login endpoint
lfades May 18, 2021
1d24515
Added logout endpoint
lfades May 19, 2021
f6ec88a
Add missing logout files
lfades May 20, 2021
7d7e434
Added signup endpoint
lfades May 20, 2021
0e546a1
Removed customers old endpoints
lfades May 20, 2021
bd065a7
Moved endpoints to nested folder
lfades May 20, 2021
ff2b12b
Removed old customer endpoint builders
lfades May 20, 2021
1086fce
Updated login operation
lfades May 20, 2021
4412d8e
Updated login operation
lfades May 20, 2021
6bcf9f9
Added getAllPages operation
lfades May 20, 2021
012f4b0
Renamed endpoint operations to handlers
lfades May 20, 2021
35c5b1b
Changed import
lfades May 21, 2021
066a53d
Renamed operations to handlers in usage
lfades May 21, 2021
9794d5e
Moved getAllPages everywhere
lfades May 21, 2021
f4e7cb5
Moved getPage
lfades May 21, 2021
74a93b4
Updated getPage usage
lfades May 21, 2021
f2c79d0
Moved getSiteInfo
lfades May 21, 2021
779b473
Added def types for product
lfades May 22, 2021
13afbd4
Merge branch 'master' of https://github.com/vercel/commerce into node…
lfades May 22, 2021
d2abdab
Updated type
lfades May 22, 2021
564e9cf
moved products catalog endpoint
lfades May 22, 2021
90f8166
removed old catalog endpoint
lfades May 22, 2021
6af5794
Moved wishlist
lfades May 23, 2021
9347c1c
Removed commerce.endpoint
lfades May 23, 2021
2353f4b
Replaced references to commerce.endpoint
lfades May 24, 2021
11200b3
Updated catalog products
lfades May 24, 2021
676b614
Moved checkout api
lfades May 24, 2021
a1167e4
Added the get customer wishlist operation
lfades May 24, 2021
29a720e
Removed old wishlist stuff
lfades May 24, 2021
3fe75a2
Added getAllProductPaths operation
lfades May 24, 2021
c2a5904
updated reference to operation
lfades May 24, 2021
be5d47b
Moved getAllProducts
lfades May 24, 2021
a106629
Updated getProduct operation
lfades May 24, 2021
ee3e414
Removed old getConfig and references
lfades May 25, 2021
4cc3613
Removed is-allowed-method from BC
lfades May 25, 2021
f083b7e
Merge branch 'master' of https://github.com/vercel/commerce into node…
lfades May 25, 2021
58d782b
Updated types for auth hooks
lfades May 25, 2021
e7980e1
Updated useCustomer and core types
lfades May 25, 2021
f8d6932
Updated useData and util hooks
lfades May 25, 2021
0e6372c
Updated useSearch hook
lfades May 25, 2021
db8218d
Updated types for useWishlist
lfades May 25, 2021
656a5db
Added index for types
lfades May 25, 2021
cf9b341
Fixes
lfades May 25, 2021
746028f
Updated urls to the API
lfades May 26, 2021
3b74f8d
Renamed fetchInput to fetcherInput
lfades May 26, 2021
874cf9d
Updated fetch type
lfades May 28, 2021
7f2a0d9
Fixes in search hook
lfades May 28, 2021
30174c5
Updated Shopify Provider Structure (#340)
cond0r May 31, 2021
8a1da45
Merge branch 'master' of https://github.com/vercel/commerce into node…
lfades Jun 1, 2021
4611748
Merge branch 'master' of https://github.com/vercel/commerce into node…
lfades Jun 1, 2021
a908eba
Added category type and normalizer
lfades Jun 1, 2021
7c9e8af
updated init script to exclude other providers
lfades Jun 1, 2021
9f6dd27
Excluded swell and venture temporarily
lfades Jun 1, 2021
5aa36df
Fix category & color normalization
cond0r Jun 1, 2021
c4d3011
Fixed category normalizer in shopify
lfades Jun 1, 2021
c786df5
Don't use getSlug for category on /search
lfades Jun 1, 2021
f10cada
Merge branch 'nodejs-provider' of https://github.com/vercel/commerce …
lfades Jun 1, 2021
9f2c076
Update colors.ts
cond0r Jun 1, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions components/cart/CartItem/CartItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Link from 'next/link'
import s from './CartItem.module.css'
import { Trash, Plus, Minus } from '@components/icons'
import { useUI } from '@components/ui/context'
import type { LineItem } from '@framework/types'
import type { LineItem } from '@commerce/types/cart'
import usePrice from '@framework/product/use-price'
import useUpdateItem from '@framework/cart/use-update-item'
import useRemoveItem from '@framework/cart/use-remove-item'
Expand Down Expand Up @@ -35,18 +35,18 @@ const CartItem = ({

const updateItem = useUpdateItem({ item })
const removeItem = useRemoveItem()
const [quantity, setQuantity] = useState(item.quantity)
const [quantity, setQuantity] = useState<number | ''>(item.quantity)
const [removing, setRemoving] = useState(false)

const updateQuantity = async (val: number) => {
await updateItem({ quantity: val })
}

const handleQuantity = (e: ChangeEvent<HTMLInputElement>) => {
const val = Number(e.target.value)
const val = !e.target.value ? '' : Number(e.target.value)

if (Number.isInteger(val) && val >= 0) {
setQuantity(Number(e.target.value))
if (!val || (Number.isInteger(val) && val >= 0)) {
setQuantity(val)
}
}
const handleBlur = () => {
Expand Down
2 changes: 1 addition & 1 deletion components/common/Footer/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { FC } from 'react'
import cn from 'classnames'
import Link from 'next/link'
import { useRouter } from 'next/router'
import type { Page } from '@framework/common/get-all-pages'
import type { Page } from '@commerce/types/page'
import getSlug from '@lib/get-slug'
import { Github, Vercel } from '@components/icons'
import { Logo, Container } from '@components/ui'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FC } from 'react'
import Link from 'next/link'
import type { Product } from '@commerce/types'
import type { Product } from '@commerce/types/product'
import { Grid } from '@components/ui'
import { ProductCard } from '@components/product'
import s from './HomeAllProductsGrid.module.css'
Expand Down
15 changes: 8 additions & 7 deletions components/common/Layout/Layout.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import cn from 'classnames'
import dynamic from 'next/dynamic'
import s from './Layout.module.css'
import { useRouter } from 'next/router'
import React, { FC } from 'react'
import { useRouter } from 'next/router'
import dynamic from 'next/dynamic'
import cn from 'classnames'
import type { Page } from '@commerce/types/page'
import type { Category } from '@commerce/types/site'
import { CommerceProvider } from '@framework'
import { useAcceptCookies } from '@lib/hooks/useAcceptCookies'
import { useUI } from '@components/ui/context'
import { Navbar, Footer } from '@components/common'
import { useAcceptCookies } from '@lib/hooks/useAcceptCookies'
import { Sidebar, Button, Modal, LoadingDots } from '@components/ui'
import CartSidebarView from '@components/cart/CartSidebarView'
import type { Page, Category } from '@commerce/types'
import LoginView from '@components/auth/LoginView'
import { CommerceProvider } from '@framework'
import s from './Layout.module.css'

const Loading = () => (
<div className="w-80 h-80 flex items-center text-center justify-center p-3">
Expand Down
12 changes: 5 additions & 7 deletions components/common/Navbar/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,11 @@ const Navbar: FC<NavbarProps> = ({ links }) => (
<Link href="/search">
<a className={s.link}>All</a>
</Link>
{links
? links.map((l) => (
<Link href={l.href}>
<a className={s.link}>{l.label}</a>
</Link>
))
: null}
{links?.map((l) => (
<Link href={l.href} key={l.href}>
<a className={s.link}>{l.label}</a>
</Link>
))}
</nav>
</div>

Expand Down
2 changes: 1 addition & 1 deletion components/common/UserNav/UserNav.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { FC } from 'react'
import Link from 'next/link'
import cn from 'classnames'
import type { LineItem } from '@framework/types'
import type { LineItem } from '@commerce/types/cart'
import useCart from '@framework/cart/use-cart'
import useCustomer from '@framework/customer/use-customer'
import { Avatar } from '@components/common'
Expand Down
2 changes: 1 addition & 1 deletion components/product/ProductCard/ProductCard.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { FC } from 'react'
import cn from 'classnames'
import Link from 'next/link'
import type { Product } from '@commerce/types'
import type { Product } from '@commerce/types/product'
import s from './ProductCard.module.css'
import Image, { ImageProps } from 'next/image'
import WishlistButton from '@components/wishlist/WishlistButton'
Expand Down
9 changes: 7 additions & 2 deletions components/product/ProductView/ProductView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { FC, useEffect, useState } from 'react'
import s from './ProductView.module.css'
import { Swatch, ProductSlider } from '@components/product'
import { Button, Container, Text, useUI } from '@components/ui'
import type { Product } from '@commerce/types'
import type { Product } from '@commerce/types/product'
import usePrice from '@framework/product/use-price'
import { useAddItem } from '@framework/cart'
import { getVariant, SelectedOptions } from '../helpers'
Expand All @@ -18,6 +18,8 @@ interface Props {
}

const ProductView: FC<Props> = ({ product }) => {
// TODO: fix this missing argument issue
/* @ts-ignore */
const addItem = useAddItem()
const { price } = usePrice({
amount: product.price.value,
Expand Down Expand Up @@ -146,8 +148,11 @@ const ProductView: FC<Props> = ({ product }) => {
className={s.button}
onClick={addToCart}
loading={loading}
disabled={variant?.availableForSale === false}
>
Add to Cart
{variant?.availableForSale === false
? 'Not Available'
: 'Add To Cart'}
</Button>
</div>
</div>
Expand Down
5 changes: 3 additions & 2 deletions components/product/Swatch/Swatch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,15 @@ const Swatch: FC<Omit<ButtonProps, 'variant'> & SwatchProps> = ({
className={swatchClassName}
style={color ? { backgroundColor: color } : {}}
aria-label="Variant Swatch"
{...(label && color && { title: label })}
{...props}
>
{variant === 'color' && active && (
{color && active && (
<span>
<Check />
</span>
)}
{variant !== 'color' ? label : null}
{!color ? label : null}
</Button>
)
}
Expand Down
2 changes: 1 addition & 1 deletion components/product/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Product } from '@commerce/types'
import type { Product } from '@commerce/types/product'
export type SelectedOptions = Record<string, string | null>

export function getVariant(product: Product, opts: SelectedOptions) {
Expand Down
2 changes: 1 addition & 1 deletion components/wishlist/WishlistButton/WishlistButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import useAddItem from '@framework/wishlist/use-add-item'
import useCustomer from '@framework/customer/use-customer'
import useWishlist from '@framework/wishlist/use-wishlist'
import useRemoveItem from '@framework/wishlist/use-remove-item'
import type { Product, ProductVariant } from '@commerce/types'
import type { Product, ProductVariant } from '@commerce/types/product'

type Props = {
productId: Product['id']
Expand Down
11 changes: 7 additions & 4 deletions components/wishlist/WishlistCard/WishlistCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Trash } from '@components/icons'
import { Button, Text } from '@components/ui'

import { useUI } from '@components/ui/context'
import type { Product } from '@commerce/types'
import type { Product } from '@commerce/types/product'
import usePrice from '@framework/product/use-price'
import useAddItem from '@framework/cart/use-add-item'
import useRemoveItem from '@framework/wishlist/use-remove-item'
Expand All @@ -20,14 +20,17 @@ const placeholderImg = '/product-img-placeholder.svg'

const WishlistCard: FC<Props> = ({ product }) => {
const { price } = usePrice({
amount: product.prices?.price?.value,
baseAmount: product.prices?.retailPrice?.value,
currencyCode: product.prices?.price?.currencyCode!,
amount: product.price?.value,
baseAmount: product.price?.retailPrice,
currencyCode: product.price?.currencyCode!,
})
// @ts-ignore Wishlist is not always enabled
const removeItem = useRemoveItem({ wishlist: { includeProducts: true } })
const [loading, setLoading] = useState(false)
const [removing, setRemoving] = useState(false)

// TODO: fix this missing argument issue
/* @ts-ignore */
const addItem = useAddItem()
const { openSidebar } = useUI()

Expand Down
78 changes: 0 additions & 78 deletions framework/bigcommerce/api/cart/index.ts

This file was deleted.

48 changes: 0 additions & 48 deletions framework/bigcommerce/api/catalog/products.ts

This file was deleted.

Loading