Upgrade dependencies & pnpm (#785)

* Updated log

* Updates to root

* Updates to pnpm

* successfully moved to pnpm

* type issue

* Local as the default provider

* Upgrade dependencies

* Revert to local

* Upgrade React

* Update node-fetch deps

* Fix types

* Ignore warnings

* Fix missing dependency

* Update pnpm-lock.yaml

* Add missing @types/cookie

* Upgrade dependencies

* Fix missing dependencies

* Update README.md

Co-authored-by: Bel Curcio <curciobel@gmail.com>
This commit is contained in:
Catalin Pinte
2022-09-19 08:14:49 +03:00
committed by GitHub
parent 87134e2990
commit 11609a9e71
46 changed files with 10129 additions and 8084 deletions

View File

@@ -49,34 +49,40 @@
}
},
"dependencies": {
"@vercel/commerce": "^0.0.1",
"@vercel/fetch": "^6.1.1",
"lodash.debounce": "^4.0.8"
"@vercel/commerce": "workspace:*",
"@vercel/fetch": "^6.2.0",
"js-cookie": "^3.0.1",
"lodash.debounce": "^4.0.8",
"node-fetch": "^2.6.7"
},
"peerDependencies": {
"next": "^12",
"react": "^17",
"react-dom": "^17"
"react": "^18",
"react-dom": "^18"
},
"devDependencies": {
"@graphql-codegen/cli": "^2.3.1",
"@graphql-codegen/cli": "^2.7.0",
"@graphql-codegen/schema-ast": "^2.4.1",
"@graphql-codegen/typescript": "^2.4.2",
"@graphql-codegen/typescript-operations": "^2.2.2",
"@taskr/clear": "^1.1.0",
"@taskr/esnext": "^1.1.0",
"@taskr/watch": "^1.1.0",
"@types/js-cookie": "^3.0.2",
"@types/lodash.debounce": "^4.0.6",
"@types/node": "^17.0.8",
"@types/react": "^17.0.38",
"@types/node-fetch": "^2.6.2",
"@types/react": "^18.0.14",
"graphql": "^16.0.0",
"lint-staged": "^12.1.7",
"next": "^12.0.8",
"prettier": "^2.5.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"taskr": "^1.1.0",
"taskr-swc": "^0.0.1",
"typescript": "^4.5.4"
"ts-node": "^10.9.1",
"typescript": "^4.7.4"
},
"lint-staged": {
"**/*.{js,jsx,ts,tsx,json}": [

View File

@@ -1,6 +1,12 @@
import { useCallback } from 'react'
import type { MutationHookContext, HookFetcherContext, MutationHook } from '@vercel/commerce/utils/types'
import useRemoveItem, { UseRemoveItem } from '@vercel/commerce/cart/use-remove-item'
import type {
MutationHookContext,
HookFetcherContext,
MutationHook,
} from '@vercel/commerce/utils/types'
import useRemoveItem, {
UseRemoveItem,
} from '@vercel/commerce/cart/use-remove-item'
import useCart from './use-cart'
import * as mutation from '../utils/mutations'
import { getCheckoutId, checkoutToCart } from '../utils'
@@ -11,7 +17,11 @@ export default useRemoveItem as UseRemoveItem<typeof handler>
export const handler = {
fetchOptions: { query: mutation.CheckoutLineDelete },
async fetcher({ input: { itemId }, options, fetch }: HookFetcherContext<RemoveItemHook>) {
async fetcher({
input: { itemId },
options,
fetch,
}: HookFetcherContext<RemoveItemHook>) {
const data = await fetch<Mutation, MutationCheckoutLineDeleteArgs>({
...options,
variables: {
@@ -27,7 +37,7 @@ export const handler = {
const { mutate } = useCart()
return useCallback(
async function removeItem(input) {
async function removeItem(input: { id: string }) {
const data = await fetch({ input: { itemId: input.id } })
await mutate(data, false)