Progress, Changes types, readme and restoring functionality

This commit is contained in:
Belen Curcio 2021-01-10 13:08:34 -03:00
parent ab16960ddb
commit 0d4355b431
11 changed files with 20 additions and 15 deletions

1
.gitignore vendored
View File

@ -25,6 +25,7 @@ yarn-debug.log*
yarn-error.log*
# local env files
.env
.env.local
.env.development.local
.env.test.local

View File

@ -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'
```

View File

@ -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'

View File

@ -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']

View File

@ -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[]

View File

@ -16,7 +16,7 @@ export interface UseWishlistOptions {
}
export interface UseWishlistInput extends UseWishlistOptions {
customerId?: number
customerId?: Customer['id']
}
export const fetcher: HookFetcher<Wishlist | null, UseWishlistInput> = (

View File

@ -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

View File

@ -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,

View File

@ -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,

View File

@ -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"]
}