mirror of
https://github.com/vercel/commerce.git
synced 2025-03-14 22:42:33 +00:00
Progress, Changes types, readme and restoring functionality
This commit is contained in:
parent
ab16960ddb
commit
0d4355b431
1
.gitignore
vendored
1
.gitignore
vendored
@ -25,6 +25,7 @@ yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# local env files
|
||||
.env
|
||||
.env.local
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
|
@ -124,3 +124,11 @@ Main folder and its exposed functions
|
||||
|
||||
- `config.json`
|
||||
- README.md
|
||||
|
||||
#### Example of correct usage of Commece Framework
|
||||
|
||||
```js
|
||||
import { useUI } from '@components/ui'
|
||||
import { useCustomer } from '@framework/customer'
|
||||
import { useAddItem, useWishlist, useRemoveItem } from '@framework/wishlist'
|
||||
```
|
||||
|
@ -10,3 +10,4 @@ export { default as Skeleton } from './Skeleton'
|
||||
export { default as Modal } from './Modal'
|
||||
export { default as Text } from './Text'
|
||||
export { default as Input } from './Input'
|
||||
export { useUI } from './context'
|
||||
|
@ -1,13 +1,10 @@
|
||||
import React, { FC, useState } from 'react'
|
||||
import cn from 'classnames'
|
||||
import { Heart } from '@components/icons'
|
||||
import { useUI } from '@components/ui/context'
|
||||
|
||||
import type { ProductNode } from '@framework/api/operations/get-all-products'
|
||||
import useCustomer from '@framework/customer/use-customer'
|
||||
import useAddItem from '@framework/wishlist/use-add-item'
|
||||
import useWishlist from '@framework/wishlist/use-wishlist'
|
||||
import useRemoveItem from '@framework/wishlist/use-remove-item'
|
||||
import { useUI } from '@components/ui'
|
||||
import { useCustomer } from '@framework/customer'
|
||||
import { useAddItem, useWishlist, useRemoveItem } from '@framework/wishlist'
|
||||
|
||||
type Props = {
|
||||
productId: Product['id']
|
||||
|
@ -21,10 +21,10 @@ export type ItemBody = {
|
||||
|
||||
export type AddItemBody = { item: ItemBody }
|
||||
|
||||
export type RemoveItemBody = { itemId: string }
|
||||
export type RemoveItemBody = { itemId: Product['id'] }
|
||||
|
||||
export type WishlistBody = {
|
||||
customer_id: number
|
||||
customer_id: Customer['id']
|
||||
is_public: number
|
||||
name: string
|
||||
items: any[]
|
||||
|
@ -16,7 +16,7 @@ export interface UseWishlistOptions {
|
||||
}
|
||||
|
||||
export interface UseWishlistInput extends UseWishlistOptions {
|
||||
customerId?: number
|
||||
customerId?: Customer['id']
|
||||
}
|
||||
|
||||
export const fetcher: HookFetcher<Wishlist | null, UseWishlistInput> = (
|
||||
|
4
framework/types.d.ts
vendored
4
framework/types.d.ts
vendored
@ -2,11 +2,11 @@ interface Product {
|
||||
id: string | number
|
||||
name: string
|
||||
description: string
|
||||
slug: string
|
||||
path?: string
|
||||
images: ProductImage[]
|
||||
variants: ProductVariant[]
|
||||
prices: ProductPrice[]
|
||||
slug: string
|
||||
path?: string
|
||||
}
|
||||
interface ProductImage {
|
||||
url: string
|
||||
|
@ -8,7 +8,7 @@
|
||||
"analyze": "BUNDLE_ANALYZE=both yarn build",
|
||||
"find:unused": "next-unused",
|
||||
"generate": "graphql-codegen",
|
||||
"generate:definitions": "node framework/bigcommerce/scripts/generate-definitions.js"
|
||||
"generate:definitions": "node framework/bigcommerce/lib/generate-definitions.js"
|
||||
},
|
||||
"prettier": {
|
||||
"semi": false,
|
||||
|
@ -9,8 +9,6 @@ import getAllProducts from '@framework/api/operations/get-all-products'
|
||||
import getSiteInfo from '@framework/api/operations/get-site-info'
|
||||
import getAllPages from '@framework/api/operations/get-all-pages'
|
||||
|
||||
// Outputs from providers should already be normalized
|
||||
|
||||
export async function getStaticProps({
|
||||
preview,
|
||||
locale,
|
||||
|
@ -26,6 +26,6 @@
|
||||
"@framework": ["framework/bigcommerce"]
|
||||
}
|
||||
},
|
||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "**/*.js"],
|
||||
"include": ["next-env.d.ts", "**/*.d.ts", "**/*.ts", "**/*.tsx", "**/*.js"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user