mirror of
https://github.com/vercel/commerce.git
synced 2025-05-17 15:06:59 +00:00
remove commerce js half done
This commit is contained in:
parent
f701f622a4
commit
27fd18ad9f
@ -34,6 +34,9 @@ Adding a commerce provider means adding a new folder in `packages` with a folder
|
||||
- useLogin
|
||||
- useLogout
|
||||
- useSignup
|
||||
- `brand` (optional)
|
||||
- index.ts
|
||||
- logo.tsx
|
||||
- `customer`
|
||||
- useCustomer
|
||||
- getCustomerId
|
||||
@ -69,7 +72,10 @@ Then, open [/site/.env.template](/site/.env.template) and add the provider name
|
||||
Using BigCommerce as an example. The first thing to do is export a `CommerceProvider` component that includes a `provider` object with all the handlers that can be used for hooks:
|
||||
|
||||
```tsx
|
||||
import { getCommerceProvider, useCommerce as useCoreCommerce } from '@vercel/commerce'
|
||||
import {
|
||||
getCommerceProvider,
|
||||
useCommerce as useCoreCommerce,
|
||||
} from '@vercel/commerce'
|
||||
import { bigcommerceProvider, BigcommerceProvider } from './provider'
|
||||
|
||||
export { bigcommerceProvider }
|
||||
@ -85,6 +91,9 @@ The exported types and components extend from the core ones exported by `@vercel
|
||||
The `bigcommerceProvider` object looks like this:
|
||||
|
||||
```tsx
|
||||
// optional brand theme. Uncomment the line below to use it.
|
||||
// import { brand } from './brand'
|
||||
|
||||
import { handler as useCart } from './cart/use-cart'
|
||||
import { handler as useAddItem } from './cart/use-add-item'
|
||||
import { handler as useUpdateItem } from './cart/use-update-item'
|
||||
@ -105,6 +114,8 @@ import fetcher from './fetcher'
|
||||
|
||||
export const bigcommerceProvider = {
|
||||
locale: 'en-us',
|
||||
// optional brand theme. Uncomment the line below to use it.
|
||||
// brand,
|
||||
cartCookie: 'bc_cartId',
|
||||
fetcher,
|
||||
cart: { useCart, useAddItem, useUpdateItem, useRemoveItem },
|
||||
@ -212,26 +223,44 @@ export const handler: MutationHook<AddItemHook> = {
|
||||
}
|
||||
```
|
||||
|
||||
## Brand theming (optional)
|
||||
|
||||
In order to customize the app's look and feel, you can create a brand object and add it to your provider object. The brand object has to have the following properties:
|
||||
|
||||
- Logo: a SVG logo component
|
||||
|
||||
The brand object looks like this:
|
||||
|
||||
```tsx
|
||||
import type { Brand } from '@vercel/commerce/types'
|
||||
import { Logo } from './logo'
|
||||
|
||||
export const brand: Brand.Config = {
|
||||
Logo,
|
||||
}
|
||||
```
|
||||
|
||||
## Showing progress and features
|
||||
|
||||
When creating a PR for a new provider, include this list in the PR description and mark the progress as you push so we can organize the code review. Not all points are required (but advised) so make sure to keep the list up to date.
|
||||
|
||||
**Status**
|
||||
|
||||
* [ ] CommerceProvider
|
||||
* [ ] Schema & TS types
|
||||
* [ ] API Operations - Get all collections
|
||||
* [ ] API Operations - Get all pages
|
||||
* [ ] API Operations - Get all products
|
||||
* [ ] API Operations - Get page
|
||||
* [ ] API Operations - Get product
|
||||
* [ ] API Operations - Get Shop Info (categories and vendors working — `vendors` query still a WIP PR on Reaction)
|
||||
* [ ] Hook - Add Item
|
||||
* [ ] Hook - Remove Item
|
||||
* [ ] Hook - Update Item
|
||||
* [ ] Hook - Get Cart (account-tied carts working, anonymous carts working, cart reconciliation working)
|
||||
* [ ] Auth (based on a WIP PR on Reaction - still need to implement refresh tokens)
|
||||
* [ ] Customer information
|
||||
* [ ] Product attributes - Size, Colors
|
||||
* [ ] Custom checkout
|
||||
* [ ] Typing (in progress)
|
||||
* [ ] Tests
|
||||
- [ ] CommerceProvider
|
||||
- [ ] Schema & TS types
|
||||
- [ ] API Operations - Get all collections
|
||||
- [ ] API Operations - Get all pages
|
||||
- [ ] API Operations - Get all products
|
||||
- [ ] API Operations - Get page
|
||||
- [ ] API Operations - Get product
|
||||
- [ ] API Operations - Get Shop Info (categories and vendors working — `vendors` query still a WIP PR on Reaction)
|
||||
- [ ] Hook - Add Item
|
||||
- [ ] Hook - Remove Item
|
||||
- [ ] Hook - Update Item
|
||||
- [ ] Hook - Get Cart (account-tied carts working, anonymous carts working, cart reconciliation working)
|
||||
- [ ] Auth (based on a WIP PR on Reaction - still need to implement refresh tokens)
|
||||
- [ ] Customer information
|
||||
- [ ] Product attributes - Size, Colors
|
||||
- [ ] Custom checkout
|
||||
- [ ] Typing (in progress)
|
||||
- [ ] Tests
|
||||
|
@ -1,6 +0,0 @@
|
||||
import type { Brand } from '@vercel/commerce/types'
|
||||
import { Logo } from './logo'
|
||||
|
||||
export const brand: Brand.Config = {
|
||||
Logo,
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
export const Logo = ({ className = '', ...props }) => (
|
||||
<svg
|
||||
height={42}
|
||||
width={42}
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 100 60"
|
||||
{...props}
|
||||
>
|
||||
<path
|
||||
d="M51.9277 0.756117C52.9028 -0.252039 54.4838 -0.252039 55.4594 0.756117L89.1534 35.5982C90.1285 36.6063 90.1285 38.2414 89.1534 39.2502L86.0727 42.4353L48.8476 3.94245L51.9277 0.756117Z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
<path
|
||||
d="M59.0127 22.2828L38.4958 1.07695C37.5207 0.0687988 35.9381 0.0687982 34.9641 1.07813L1.69839 35.4926C0.723292 36.5014 0.723292 38.1365 1.69953 39.1446L20.4522 58.526C21.4273 59.5335 23.006 59.5347 23.9828 58.5271L45.3873 36.4398L66.8549 58.54C67.8283 59.5423 69.4007 59.5435 70.3764 58.5424L82.1003 46.5108L59.0127 22.2828ZM28.9042 36.9559C25.0418 36.9559 22.036 33.7045 22.036 29.8548C22.036 26.0034 25.0418 22.7532 28.9042 22.7532C32.7666 22.7532 35.7725 26.004 35.7725 29.8548C35.7713 33.7056 32.7655 36.9559 28.9042 36.9559Z"
|
||||
fill="currentColor"
|
||||
/>
|
||||
</svg>
|
||||
)
|
@ -1,5 +1,3 @@
|
||||
import { brand } from './brand'
|
||||
|
||||
import { handler as useCart } from './cart/use-cart'
|
||||
import { handler as useAddItem } from './cart/use-add-item'
|
||||
import { handler as useUpdateItem } from './cart/use-update-item'
|
||||
@ -26,7 +24,6 @@ import { default as sdkFetcher } from './fetcher'
|
||||
|
||||
export const commercejsProvider = {
|
||||
locale: LOCALE,
|
||||
brand,
|
||||
cartCookie: CART_COOKIE,
|
||||
customerCookie: CUSTOMER_COOKIE,
|
||||
fetcher: sdkFetcher,
|
||||
|
Loading…
x
Reference in New Issue
Block a user