mirror of
https://github.com/vercel/commerce.git
synced 2025-05-18 15:36:58 +00:00
Fixed types in commercejs
This commit is contained in:
parent
0b8d90c773
commit
01244c89ce
158
package-lock.json
generated
158
package-lock.json
generated
@ -583,7 +583,6 @@
|
||||
"version": "7.16.7",
|
||||
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.16.7.tgz",
|
||||
"integrity": "sha512-9E9FJowqAsytyOY6LG+1KuueckRL+aQW+mKvXRXnuFGyRAyepJPmEo9vgMfXUA6O9u3IeEdv9MAkppFcaQwogQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"regenerator-runtime": "^0.13.4"
|
||||
},
|
||||
@ -643,6 +642,15 @@
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@chec/commerce.js": {
|
||||
"version": "2.8.0",
|
||||
"resolved": "https://registry.npmjs.org/@chec/commerce.js/-/commerce.js-2.8.0.tgz",
|
||||
"integrity": "sha512-OPBphT/hU33iDp52zzYOqz/oSXLhEuhGVUg2UNvYtmBW4eCNmtsM0dqW0+wu+6K0d6fZojurCBdVQMKb2R7l3g==",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.7.4",
|
||||
"axios": "^0.21.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@csstools/convert-colors": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/@csstools/convert-colors/-/convert-colors-1.4.0.tgz",
|
||||
@ -1173,6 +1181,15 @@
|
||||
"integrity": "sha512-PhoQPbwPYspXqf7lkwtF7aJzAwL88t+9E/e0b2X84tlHpU8ZuS9UNnLtkT0XhyZJYHpET5qRfIdZ0HBIxuc7HQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/chec__commerce.js": {
|
||||
"version": "2.8.4",
|
||||
"resolved": "https://registry.npmjs.org/@types/chec__commerce.js/-/chec__commerce.js-2.8.4.tgz",
|
||||
"integrity": "sha512-hyR2OXEB3gIRp/ESWOQaFStefBG+C5OdnkxGC1Gmp0ePVzl/wk5FyvaK5NsT1ddNC/y1YsmDAVPe+DArr6/9Jg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/chec__commerce.js": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/cookie": {
|
||||
"version": "0.4.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.4.1.tgz",
|
||||
@ -1409,6 +1426,10 @@
|
||||
"resolved": "packages/bigcommerce",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/@vercel/commerce-commercejs": {
|
||||
"resolved": "packages/commercejs",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/@vercel/commerce-local": {
|
||||
"resolved": "packages/local",
|
||||
"link": true
|
||||
@ -1856,6 +1877,14 @@
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/axios": {
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz",
|
||||
"integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==",
|
||||
"dependencies": {
|
||||
"follow-redirects": "^1.14.0"
|
||||
}
|
||||
},
|
||||
"node_modules/axobject-query": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-2.2.0.tgz",
|
||||
@ -3586,6 +3615,25 @@
|
||||
"deprecated": "flatten is deprecated in favor of utility frameworks such as lodash.",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/follow-redirects": {
|
||||
"version": "1.14.7",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.7.tgz",
|
||||
"integrity": "sha512-+hbxoLbFMbRKDwohX8GkTataGqO6Jb7jGwpAlwgy2bIz25XtRm7KEzJM76R1WiNT5SwZkX4Y75SwBolkpmE7iQ==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "individual",
|
||||
"url": "https://github.com/sponsors/RubenVerborgh"
|
||||
}
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=4.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"debug": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/foreach": {
|
||||
"version": "2.0.5",
|
||||
"resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz",
|
||||
@ -7788,8 +7836,7 @@
|
||||
"node_modules/regenerator-runtime": {
|
||||
"version": "0.13.9",
|
||||
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz",
|
||||
"integrity": "sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA==",
|
||||
"dev": true
|
||||
"integrity": "sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA=="
|
||||
},
|
||||
"node_modules/regexp.prototype.flags": {
|
||||
"version": "1.3.1",
|
||||
@ -9428,6 +9475,46 @@
|
||||
"node": ">=4.2.0"
|
||||
}
|
||||
},
|
||||
"packages/commercejs": {
|
||||
"name": "@vercel/commerce-commercejs",
|
||||
"version": "0.0.1",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@chec/commerce.js": "^2.8.0",
|
||||
"@vercel/commerce": "^0.0.1",
|
||||
"@vercel/fetch": "^6.1.1",
|
||||
"swr": "^0.5.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/chec__commerce.js": "^2.8.4",
|
||||
"@types/node": "^15.12.4",
|
||||
"@types/react": "^17.0.8",
|
||||
"lint-staged": "^12.1.7",
|
||||
"next": "^12.0.3",
|
||||
"prettier": "^2.5.1",
|
||||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2",
|
||||
"typescript": "^4.6.0-dev.20220108"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"next": "^12",
|
||||
"react": "^17",
|
||||
"react-dom": "^17"
|
||||
}
|
||||
},
|
||||
"packages/commercejs/node_modules/typescript": {
|
||||
"version": "4.6.0-dev.20220113",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.0-dev.20220113.tgz",
|
||||
"integrity": "sha512-hZj5awMxIZp7IhDt1B1ZAEnL0nSTqJiAUP8mTlGA9EXLrRMSZMwSnknu8fxJjMg/miexSfwk4+Y0Ja7M+6PyXw==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4.2.0"
|
||||
}
|
||||
},
|
||||
"packages/local": {
|
||||
"name": "@vercel/commerce-local",
|
||||
"version": "0.0.1",
|
||||
@ -9969,7 +10056,6 @@
|
||||
"version": "7.16.7",
|
||||
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.16.7.tgz",
|
||||
"integrity": "sha512-9E9FJowqAsytyOY6LG+1KuueckRL+aQW+mKvXRXnuFGyRAyepJPmEo9vgMfXUA6O9u3IeEdv9MAkppFcaQwogQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"regenerator-runtime": "^0.13.4"
|
||||
}
|
||||
@ -10013,6 +10099,15 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"@chec/commerce.js": {
|
||||
"version": "2.8.0",
|
||||
"resolved": "https://registry.npmjs.org/@chec/commerce.js/-/commerce.js-2.8.0.tgz",
|
||||
"integrity": "sha512-OPBphT/hU33iDp52zzYOqz/oSXLhEuhGVUg2UNvYtmBW4eCNmtsM0dqW0+wu+6K0d6fZojurCBdVQMKb2R7l3g==",
|
||||
"requires": {
|
||||
"@babel/runtime": "^7.7.4",
|
||||
"axios": "^0.21.1"
|
||||
}
|
||||
},
|
||||
"@csstools/convert-colors": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/@csstools/convert-colors/-/convert-colors-1.4.0.tgz",
|
||||
@ -10376,6 +10471,15 @@
|
||||
"integrity": "sha512-PhoQPbwPYspXqf7lkwtF7aJzAwL88t+9E/e0b2X84tlHpU8ZuS9UNnLtkT0XhyZJYHpET5qRfIdZ0HBIxuc7HQ==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/chec__commerce.js": {
|
||||
"version": "2.8.4",
|
||||
"resolved": "https://registry.npmjs.org/@types/chec__commerce.js/-/chec__commerce.js-2.8.4.tgz",
|
||||
"integrity": "sha512-hyR2OXEB3gIRp/ESWOQaFStefBG+C5OdnkxGC1Gmp0ePVzl/wk5FyvaK5NsT1ddNC/y1YsmDAVPe+DArr6/9Jg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/chec__commerce.js": "*"
|
||||
}
|
||||
},
|
||||
"@types/cookie": {
|
||||
"version": "0.4.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.4.1.tgz",
|
||||
@ -10585,8 +10689,8 @@
|
||||
"@vercel/commerce-bigcommerce": {
|
||||
"version": "file:packages/bigcommerce",
|
||||
"requires": {
|
||||
"@types/cookie": "*",
|
||||
"@types/jsonwebtoken": "*",
|
||||
"@types/cookie": "^0.4.1",
|
||||
"@types/jsonwebtoken": "^8.5.7",
|
||||
"@types/lodash.debounce": "^4.0.6",
|
||||
"@types/node": "^15.12.4",
|
||||
"@types/react": "^17.0.8",
|
||||
@ -10613,6 +10717,32 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"@vercel/commerce-commercejs": {
|
||||
"version": "file:packages/commercejs",
|
||||
"requires": {
|
||||
"@chec/commerce.js": "^2.8.0",
|
||||
"@types/chec__commerce.js": "*",
|
||||
"@types/node": "^15.12.4",
|
||||
"@types/react": "^17.0.8",
|
||||
"@vercel/commerce": "^0.0.1",
|
||||
"@vercel/fetch": "^6.1.1",
|
||||
"lint-staged": "^12.1.7",
|
||||
"next": "^12.0.3",
|
||||
"prettier": "^2.5.1",
|
||||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2",
|
||||
"swr": "^0.5.6",
|
||||
"typescript": "^4.6.0-dev.20220108"
|
||||
},
|
||||
"dependencies": {
|
||||
"typescript": {
|
||||
"version": "4.6.0-dev.20220113",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.0-dev.20220113.tgz",
|
||||
"integrity": "sha512-hZj5awMxIZp7IhDt1B1ZAEnL0nSTqJiAUP8mTlGA9EXLrRMSZMwSnknu8fxJjMg/miexSfwk4+Y0Ja7M+6PyXw==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"@vercel/commerce-local": {
|
||||
"version": "file:packages/local",
|
||||
"requires": {
|
||||
@ -10982,6 +11112,14 @@
|
||||
"integrity": "sha512-WKTW1+xAzhMS5dJsxWkliixlO/PqC4VhmO9T4juNYcaTg9jzWiJsou6m5pxWYGfigWbwzJWeFY6z47a+4neRXA==",
|
||||
"dev": true
|
||||
},
|
||||
"axios": {
|
||||
"version": "0.21.4",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz",
|
||||
"integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==",
|
||||
"requires": {
|
||||
"follow-redirects": "^1.14.0"
|
||||
}
|
||||
},
|
||||
"axobject-query": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-2.2.0.tgz",
|
||||
@ -12345,6 +12483,11 @@
|
||||
"integrity": "sha512-dVsPA/UwQ8+2uoFe5GHtiBMu48dWLTdsuEd7CKGlZlD78r1TTWBvDuFaFGKCo/ZfEr95Uk56vZoX86OsHkUeIg==",
|
||||
"dev": true
|
||||
},
|
||||
"follow-redirects": {
|
||||
"version": "1.14.7",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.7.tgz",
|
||||
"integrity": "sha512-+hbxoLbFMbRKDwohX8GkTataGqO6Jb7jGwpAlwgy2bIz25XtRm7KEzJM76R1WiNT5SwZkX4Y75SwBolkpmE7iQ=="
|
||||
},
|
||||
"foreach": {
|
||||
"version": "2.0.5",
|
||||
"resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz",
|
||||
@ -15503,8 +15646,7 @@
|
||||
"regenerator-runtime": {
|
||||
"version": "0.13.9",
|
||||
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz",
|
||||
"integrity": "sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA==",
|
||||
"dev": true
|
||||
"integrity": "sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA=="
|
||||
},
|
||||
"regexp.prototype.flags": {
|
||||
"version": "1.3.1",
|
||||
|
2
packages/commercejs/.prettierignore
Normal file
2
packages/commercejs/.prettierignore
Normal file
@ -0,0 +1,2 @@
|
||||
node_modules
|
||||
dist
|
6
packages/commercejs/.prettierrc
Normal file
6
packages/commercejs/.prettierrc
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"semi": false,
|
||||
"singleQuote": true,
|
||||
"tabWidth": 2,
|
||||
"useTabs": false
|
||||
}
|
@ -45,6 +45,7 @@
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@chec/commerce.js": "^2.8.0",
|
||||
"@vercel/commerce": "^0.0.1",
|
||||
"@vercel/fetch": "^6.1.1",
|
||||
"swr": "^0.5.6"
|
||||
@ -55,6 +56,7 @@
|
||||
"react-dom": "^17"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/chec__commerce.js": "^2.8.4",
|
||||
"@types/node": "^15.12.4",
|
||||
"@types/react": "^17.0.8",
|
||||
"lint-staged": "^12.1.7",
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { GetAPISchema, createEndpoint } from '@commerce/api'
|
||||
import checkoutEndpoint from '@commerce/api/endpoints/checkout'
|
||||
import { GetAPISchema, createEndpoint } from '@vercel/commerce/api'
|
||||
import checkoutEndpoint from '@vercel/commerce/api/endpoints/checkout'
|
||||
import type { CheckoutSchema } from '../../../types/checkout'
|
||||
import type { CommercejsAPI } from '../..'
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import type { CardFields } from '@commerce/types/customer/card'
|
||||
import type { AddressFields } from '@commerce/types/customer/address'
|
||||
import type { CardFields } from '@vercel/commerce/types/customer/card'
|
||||
import type { AddressFields } from '@vercel/commerce/types/customer/address'
|
||||
import type { CheckoutEndpoint } from '.'
|
||||
import sdkFetcherFunction from '../../utils/sdk-fetch'
|
||||
import { normalizeTestCheckout } from '../../../utils/normalize-checkout'
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { GetAPISchema, createEndpoint } from '@commerce/api'
|
||||
import loginEndpoint from '@commerce/api/endpoints/login'
|
||||
import { GetAPISchema, createEndpoint } from '@vercel/commerce/api'
|
||||
import loginEndpoint from '@vercel/commerce/api/endpoints/login'
|
||||
import type { LoginSchema } from '../../../types/login'
|
||||
import type { CommercejsAPI } from '../..'
|
||||
import login from './login'
|
||||
|
@ -1,5 +1,5 @@
|
||||
import type { CommerceAPI, CommerceAPIConfig } from '@commerce/api'
|
||||
import { getCommerceApi as commerceApi } from '@commerce/api'
|
||||
import type { CommerceAPI, CommerceAPIConfig } from '@vercel/commerce/api'
|
||||
import { getCommerceApi as commerceApi } from '@vercel/commerce/api'
|
||||
|
||||
import getAllPages from './operations/get-all-pages'
|
||||
import getPage from './operations/get-page'
|
||||
|
@ -1,4 +1,4 @@
|
||||
import type { OperationContext } from '@commerce/api/operations'
|
||||
import type { OperationContext } from '@vercel/commerce/api/operations'
|
||||
import type {
|
||||
GetAllProductPathsOperation,
|
||||
CommercejsProduct,
|
||||
|
@ -1,4 +1,4 @@
|
||||
import type { OperationContext } from '@commerce/api/operations'
|
||||
import type { OperationContext } from '@vercel/commerce/api/operations'
|
||||
import type { GetAllProductsOperation } from '../../types/product'
|
||||
import type { CommercejsConfig, Provider } from '../index'
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import type { OperationContext } from '@commerce/api/operations'
|
||||
import type { OperationContext } from '@vercel/commerce/api/operations'
|
||||
import type { GetProductOperation } from '../../types/product'
|
||||
import type { CommercejsConfig, Provider } from '../index'
|
||||
import { normalizeProduct } from '../../utils/normalize-product'
|
||||
|
@ -1,4 +1,4 @@
|
||||
import type { OperationContext } from '@commerce/api/operations'
|
||||
import type { OperationContext } from '@vercel/commerce/api/operations'
|
||||
import type { Category, GetSiteInfoOperation } from '../../types/site'
|
||||
import { normalizeCategory } from '../../utils/normalize-category'
|
||||
import type { CommercejsConfig, Provider } from '../index'
|
||||
|
@ -1,7 +1,7 @@
|
||||
import type { GraphQLFetcher } from '@commerce/api'
|
||||
import type { GraphQLFetcher } from '@vercel/commerce/api'
|
||||
import type { CommercejsConfig } from '../'
|
||||
|
||||
import { FetcherError } from '@commerce/utils/errors'
|
||||
import { FetcherError } from '@vercel/commerce/utils/errors'
|
||||
|
||||
const fetchGraphqlApi: (getConfig: () => CommercejsConfig) => GraphQLFetcher =
|
||||
() => async () => {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { useCallback } from 'react'
|
||||
import { MutationHook } from '@commerce/utils/types'
|
||||
import useLogin, { UseLogin } from '@commerce/auth/use-login'
|
||||
import type { LoginHook } from '@commerce/types/login'
|
||||
import { MutationHook } from '@vercel/commerce/utils/types'
|
||||
import useLogin, { UseLogin } from '@vercel/commerce/auth/use-login'
|
||||
import type { LoginHook } from '@vercel/commerce/types/login'
|
||||
import { getDeploymentUrl } from '../utils/get-deployment-url'
|
||||
|
||||
export default useLogin as UseLogin<typeof handler>
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { useCallback } from 'react'
|
||||
import Cookies from 'js-cookie'
|
||||
import { MutationHook } from '@commerce/utils/types'
|
||||
import useLogout, { UseLogout } from '@commerce/auth/use-logout'
|
||||
import type { LogoutHook } from '@commerce/types/logout'
|
||||
import { MutationHook } from '@vercel/commerce/utils/types'
|
||||
import useLogout, { UseLogout } from '@vercel/commerce/auth/use-logout'
|
||||
import type { LogoutHook } from '@vercel/commerce/types/logout'
|
||||
import useCustomer from '../customer/use-customer'
|
||||
import { CUSTOMER_COOKIE } from '../constants'
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { MutationHook } from '@commerce/utils/types'
|
||||
import useSignup, { UseSignup } from '@commerce/auth/use-signup'
|
||||
import { MutationHook } from '@vercel/commerce/utils/types'
|
||||
import useSignup, { UseSignup } from '@vercel/commerce/auth/use-signup'
|
||||
|
||||
export default useSignup as UseSignup<typeof handler>
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import type { AddItemHook } from '@commerce/types/cart'
|
||||
import type { MutationHook } from '@commerce/utils/types'
|
||||
import type { AddItemHook } from '@vercel/commerce/types/cart'
|
||||
import type { MutationHook } from '@vercel/commerce/utils/types'
|
||||
import { useCallback } from 'react'
|
||||
import useAddItem, { UseAddItem } from '@commerce/cart/use-add-item'
|
||||
import useAddItem, { UseAddItem } from '@vercel/commerce/cart/use-add-item'
|
||||
import type { CommercejsCart } from '../types/cart'
|
||||
import { normalizeCart } from '../utils/normalize-cart'
|
||||
import useCart from './use-cart'
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { useMemo } from 'react'
|
||||
import type { GetCartHook } from '@commerce/types/cart'
|
||||
import { SWRHook } from '@commerce/utils/types'
|
||||
import useCart, { UseCart } from '@commerce/cart/use-cart'
|
||||
import type { GetCartHook } from '@vercel/commerce/types/cart'
|
||||
import { SWRHook } from '@vercel/commerce/utils/types'
|
||||
import useCart, { UseCart } from '@vercel/commerce/cart/use-cart'
|
||||
import type { CommercejsCart } from '../types/cart'
|
||||
import { normalizeCart } from '../utils/normalize-cart'
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { useCallback } from 'react'
|
||||
import type { MutationHook } from '@commerce/utils/types'
|
||||
import type { RemoveItemHook } from '@commerce/types/cart'
|
||||
import useRemoveItem, { UseRemoveItem } from '@commerce/cart/use-remove-item'
|
||||
import type { MutationHook } from '@vercel/commerce/utils/types'
|
||||
import type { RemoveItemHook } from '@vercel/commerce/types/cart'
|
||||
import useRemoveItem, { UseRemoveItem } from '@vercel/commerce/cart/use-remove-item'
|
||||
import type { CommercejsCart } from '../types/cart'
|
||||
import { normalizeCart } from '../utils/normalize-cart'
|
||||
import useCart from './use-cart'
|
||||
|
@ -1,12 +1,12 @@
|
||||
import type { UpdateItemHook, LineItem } from '@commerce/types/cart'
|
||||
import type { UpdateItemHook, LineItem } from '@vercel/commerce/types/cart'
|
||||
import type {
|
||||
HookFetcherContext,
|
||||
MutationHookContext,
|
||||
} from '@commerce/utils/types'
|
||||
import { ValidationError } from '@commerce/utils/errors'
|
||||
} from '@vercel/commerce/utils/types'
|
||||
import { ValidationError } from '@vercel/commerce/utils/errors'
|
||||
import debounce from 'lodash.debounce'
|
||||
import { useCallback } from 'react'
|
||||
import useUpdateItem, { UseUpdateItem } from '@commerce/cart/use-update-item'
|
||||
import useUpdateItem, { UseUpdateItem } from '@vercel/commerce/cart/use-update-item'
|
||||
import type { CommercejsCart } from '../types/cart'
|
||||
import { normalizeCart } from '../utils/normalize-cart'
|
||||
import useCart from './use-cart'
|
||||
|
@ -1,8 +1,8 @@
|
||||
import type { GetCheckoutHook } from '@commerce/types/checkout'
|
||||
import type { GetCheckoutHook } from '@vercel/commerce/types/checkout'
|
||||
|
||||
import { useMemo } from 'react'
|
||||
import { SWRHook } from '@commerce/utils/types'
|
||||
import useCheckout, { UseCheckout } from '@commerce/checkout/use-checkout'
|
||||
import { SWRHook } from '@vercel/commerce/utils/types'
|
||||
import useCheckout, { UseCheckout } from '@vercel/commerce/checkout/use-checkout'
|
||||
import useSubmitCheckout from './use-submit-checkout'
|
||||
import { useCheckoutContext } from '@components/checkout/context'
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
import type { SubmitCheckoutHook } from '@commerce/types/checkout'
|
||||
import type { MutationHook } from '@commerce/utils/types'
|
||||
import type { SubmitCheckoutHook } from '@vercel/commerce/types/checkout'
|
||||
import type { MutationHook } from '@vercel/commerce/utils/types'
|
||||
|
||||
import { useCallback } from 'react'
|
||||
import useSubmitCheckout, {
|
||||
UseSubmitCheckout,
|
||||
} from '@commerce/checkout/use-submit-checkout'
|
||||
} from '@vercel/commerce/checkout/use-submit-checkout'
|
||||
import { useCheckoutContext } from '@components/checkout/context'
|
||||
|
||||
export default useSubmitCheckout as UseSubmitCheckout<typeof handler>
|
||||
|
@ -1,7 +1,7 @@
|
||||
import type { AddItemHook } from '@commerce/types/customer/address'
|
||||
import type { MutationHook } from '@commerce/utils/types'
|
||||
import type { AddItemHook } from '@vercel/commerce/types/customer/address'
|
||||
import type { MutationHook } from '@vercel/commerce/utils/types'
|
||||
import { useCallback } from 'react'
|
||||
import useAddItem, { UseAddItem } from '@commerce/customer/address/use-add-item'
|
||||
import useAddItem, { UseAddItem } from '@vercel/commerce/customer/address/use-add-item'
|
||||
import { useCheckoutContext } from '@components/checkout/context'
|
||||
|
||||
export default useAddItem as UseAddItem<typeof handler>
|
||||
|
@ -1,10 +1,10 @@
|
||||
import type { GetAddressesHook } from '@commerce/types/customer/address'
|
||||
import type { GetAddressesHook } from '@vercel/commerce/types/customer/address'
|
||||
|
||||
import { useMemo } from 'react'
|
||||
import { SWRHook } from '@commerce/utils/types'
|
||||
import { SWRHook } from '@vercel/commerce/utils/types'
|
||||
import useAddresses, {
|
||||
UseAddresses,
|
||||
} from '@commerce/customer/address/use-addresses'
|
||||
} from '@vercel/commerce/customer/address/use-addresses'
|
||||
|
||||
export default useAddresses as UseAddresses<typeof handler>
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import type { AddItemHook } from '@commerce/types/customer/card'
|
||||
import type { MutationHook } from '@commerce/utils/types'
|
||||
import type { AddItemHook } from '@vercel/commerce/types/customer/card'
|
||||
import type { MutationHook } from '@vercel/commerce/utils/types'
|
||||
import { useCallback } from 'react'
|
||||
import useAddItem, { UseAddItem } from '@commerce/customer/card/use-add-item'
|
||||
import useAddItem, { UseAddItem } from '@vercel/commerce/customer/card/use-add-item'
|
||||
import { useCheckoutContext } from '@components/checkout/context'
|
||||
|
||||
export default useAddItem as UseAddItem<typeof handler>
|
||||
|
@ -1,7 +1,7 @@
|
||||
import type { GetCardsHook } from '@commerce/types/customer/card'
|
||||
import type { GetCardsHook } from '@vercel/commerce/types/customer/card'
|
||||
import { useMemo } from 'react'
|
||||
import { SWRHook } from '@commerce/utils/types'
|
||||
import useCard, { UseCards } from '@commerce/customer/card/use-cards'
|
||||
import { SWRHook } from '@vercel/commerce/utils/types'
|
||||
import useCard, { UseCards } from '@vercel/commerce/customer/card/use-cards'
|
||||
|
||||
export default useCard as UseCards<typeof handler>
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import Cookies from 'js-cookie'
|
||||
import { decode } from 'jsonwebtoken'
|
||||
import { SWRHook } from '@commerce/utils/types'
|
||||
import useCustomer, { UseCustomer } from '@commerce/customer/use-customer'
|
||||
import { SWRHook } from '@vercel/commerce/utils/types'
|
||||
import useCustomer, { UseCustomer } from '@vercel/commerce/customer/use-customer'
|
||||
import { CUSTOMER_COOKIE, API_URL } from '../constants'
|
||||
import type { CustomerHook } from '../types/customer'
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { commerce } from './lib/commercejs'
|
||||
import type { Fetcher } from '@commerce/utils/types'
|
||||
import { FetcherError } from '@commerce/utils/errors'
|
||||
import type { Fetcher } from '@vercel/commerce/utils/types'
|
||||
import { FetcherError } from '@vercel/commerce/utils/errors'
|
||||
|
||||
function isValidSDKQuery(query?: string): query is keyof typeof commerce {
|
||||
if (!query) return false
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { commercejsProvider, CommercejsProvider } from './provider'
|
||||
import { getCommerceProvider, useCommerce as useCoreCommerce } from '@commerce'
|
||||
import { getCommerceProvider, useCommerce as useCoreCommerce } from '@vercel/commerce'
|
||||
|
||||
export { commercejsProvider }
|
||||
export type { CommercejsProvider }
|
||||
|
@ -1,2 +1,2 @@
|
||||
export * from '@commerce/product/use-price'
|
||||
export { default } from '@commerce/product/use-price'
|
||||
export * from '@vercel/commerce/product/use-price'
|
||||
export { default } from '@vercel/commerce/product/use-price'
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { SWRHook } from '@commerce/utils/types'
|
||||
import useSearch, { UseSearch } from '@commerce/product/use-search'
|
||||
import { SearchProductsHook } from '@commerce/types/product'
|
||||
import { SWRHook } from '@vercel/commerce/utils/types'
|
||||
import useSearch, { UseSearch } from '@vercel/commerce/product/use-search'
|
||||
import { SearchProductsHook } from '@vercel/commerce/types/product'
|
||||
import type { CommercejsProduct } from '../types/product'
|
||||
import { getProductSearchVariables } from '../utils/product-search'
|
||||
import { normalizeProduct } from '../utils/normalize-product'
|
||||
|
@ -1,4 +1,4 @@
|
||||
export * from '@commerce/types/cart'
|
||||
export * from '@vercel/commerce/types/cart'
|
||||
|
||||
export type { Cart as CommercejsCart } from '@chec/commerce.js/types/cart'
|
||||
export type { LineItem as CommercejsLineItem } from '@chec/commerce.js/types/line-item'
|
||||
|
@ -1,3 +1,3 @@
|
||||
export * from '@commerce/types/checkout'
|
||||
export * from '@vercel/commerce/types/checkout'
|
||||
|
||||
export type { CheckoutCapture as CommercejsCheckoutCapture } from '@chec/commerce.js/types/checkout-capture'
|
||||
|
@ -1 +1 @@
|
||||
export * from '@commerce/types/common'
|
||||
export * from '@vercel/commerce/types/common'
|
||||
|
@ -1 +1 @@
|
||||
export * from '@commerce/types/customer'
|
||||
export * from '@vercel/commerce/types/customer'
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { LoginBody, LoginTypes } from '@commerce/types/login'
|
||||
export * from '@commerce/types/login'
|
||||
import { LoginBody, LoginTypes } from '@vercel/commerce/types/login'
|
||||
export * from '@vercel/commerce/types/login'
|
||||
|
||||
export type LoginHook<T extends LoginTypes = LoginTypes> = {
|
||||
data: null
|
||||
|
@ -1 +1 @@
|
||||
export * from '@commerce/types/logout'
|
||||
export * from '@vercel/commerce/types/logout'
|
||||
|
@ -1 +1 @@
|
||||
export * from '@commerce/types/page'
|
||||
export * from '@vercel/commerce/types/page'
|
||||
|
@ -1,4 +1,4 @@
|
||||
export * from '@commerce/types/product'
|
||||
export * from '@vercel/commerce/types/product'
|
||||
|
||||
export type { Product as CommercejsProduct } from '@chec/commerce.js/types/product'
|
||||
export type { Variant as CommercejsVariant } from '@chec/commerce.js/types/variant'
|
||||
|
@ -1 +1 @@
|
||||
export * from '@commerce/types/signup'
|
||||
export * from '@vercel/commerce/types/signup'
|
||||
|
@ -1,3 +1,3 @@
|
||||
export * from '@commerce/types/site'
|
||||
export * from '@vercel/commerce/types/site'
|
||||
|
||||
export type { Category as CommercejsCategory } from '@chec/commerce.js/types/category'
|
||||
|
@ -1 +1 @@
|
||||
export * from '@commerce/types/wishlist'
|
||||
export * from '@vercel/commerce/types/wishlist'
|
||||
|
@ -1,4 +1,4 @@
|
||||
import type { Category } from '@commerce/types/site'
|
||||
import type { Category } from '@vercel/commerce/types/site'
|
||||
import type { Category as CommercejsCategory } from '@chec/commerce.js/types/category'
|
||||
|
||||
export function normalizeCategory(
|
||||
|
@ -1,5 +1,5 @@
|
||||
import type { CardFields } from '@commerce/types/customer/card'
|
||||
import type { AddressFields } from '@commerce/types/customer/address'
|
||||
import type { CardFields } from '@vercel/commerce/types/customer/card'
|
||||
import type { AddressFields } from '@vercel/commerce/types/customer/address'
|
||||
import type { CommercejsCheckoutCapture } from '../types/checkout'
|
||||
|
||||
/**
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { SearchProductsBody } from '@commerce/types/product'
|
||||
import { SearchProductsBody } from '@vercel/commerce/types/product'
|
||||
|
||||
const getFilterVariables = ({
|
||||
search,
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { HookFetcher } from '@commerce/utils/types'
|
||||
import { HookFetcher } from '@vercel/commerce/utils/types'
|
||||
|
||||
export type Wishlist = {
|
||||
items: [
|
||||
|
22
packages/commercejs/tsconfig.json
Normal file
22
packages/commercejs/tsconfig.json
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "esnext",
|
||||
"module": "esnext",
|
||||
"outDir": "dist",
|
||||
"baseUrl": "src",
|
||||
"lib": ["dom", "dom.iterable", "esnext"],
|
||||
"declaration": true,
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
"strict": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"esModuleInterop": true,
|
||||
"moduleResolution": "node",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"pretty": true,
|
||||
"jsx": "react-jsx"
|
||||
},
|
||||
"include": ["src"],
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user