mirror of
https://github.com/vercel/commerce.git
synced 2025-07-04 04:01:21 +00:00
Use kebab case instead of camel case
This commit is contained in:
parent
17f8d497b8
commit
c150a79a6b
@ -7,7 +7,7 @@ import type {
|
||||
import type { IProducts } from '@spree/storefront-api-v2-sdk/types/interfaces/Product'
|
||||
import type { SpreeApiConfig, SpreeApiProvider } from '../index'
|
||||
import type { SpreeSdkVariables } from 'framework/spree/types'
|
||||
import normalizeProduct from 'framework/spree/utils/normalizeProduct'
|
||||
import normalizeProduct from '@framework/utils/normalize-product'
|
||||
|
||||
export default function getAllProductsOperation({
|
||||
commerce,
|
||||
|
@ -7,7 +7,7 @@ import type {
|
||||
import type { IProduct } from '@spree/storefront-api-v2-sdk/types/interfaces/Product'
|
||||
import type { SpreeSdkVariables } from 'framework/spree/types'
|
||||
import MissingSlugVariableError from 'framework/spree/errors/MissingSlugVariableError'
|
||||
import normalizeProduct from 'framework/spree/utils/normalizeProduct'
|
||||
import normalizeProduct from '@framework/utils/normalize-product'
|
||||
|
||||
export default function getProductOperation({
|
||||
commerce,
|
||||
|
@ -7,7 +7,7 @@ import type {
|
||||
ITaxons,
|
||||
TaxonAttr,
|
||||
} from '@spree/storefront-api-v2-sdk/types/interfaces/Taxon'
|
||||
import { requireConfigValue } from 'framework/spree/isomorphicConfig'
|
||||
import { requireConfigValue } from '@framework/isomorphic-config'
|
||||
import type { SpreeSdkVariables } from 'framework/spree/types'
|
||||
import type { SpreeApiConfig, SpreeApiProvider } from '..'
|
||||
|
||||
|
@ -1,17 +1,17 @@
|
||||
import { SpreeApiConfig } from '..'
|
||||
import { errors, makeClient } from '@spree/storefront-api-v2-sdk'
|
||||
import { requireConfigValue } from 'framework/spree/isomorphicConfig'
|
||||
import convertSpreeErrorToGraphQlError from 'framework/spree/utils/convertSpreeErrorToGraphQlError'
|
||||
import { requireConfigValue } from '@framework/isomorphic-config'
|
||||
import convertSpreeErrorToGraphQlError from '@framework/utils/convert-spree-error-to-graph-ql-error'
|
||||
import type { ResultResponse } from '@spree/storefront-api-v2-sdk/types/interfaces/ResultResponse'
|
||||
import type {
|
||||
JsonApiListResponse,
|
||||
JsonApiSingleResponse,
|
||||
} from '@spree/storefront-api-v2-sdk/types/interfaces/JsonApi'
|
||||
import getSpreeSdkMethodFromEndpointPath from 'framework/spree/utils/getSpreeSdkMethodFromEndpointPath'
|
||||
import getSpreeSdkMethodFromEndpointPath from '@framework/utils/get-spree-sdk-method-from-endpoint-path'
|
||||
import { SpreeSdkVariables } from 'framework/spree/types'
|
||||
import SpreeSdkMethodFromEndpointPathError from 'framework/spree/errors/SpreeSdkMethodFromEndpointPathError'
|
||||
import { GraphQLFetcher, GraphQLFetcherResult } from '@commerce/api'
|
||||
import createCustomizedFetchFetcher from '../../utils/createCustomizedFetchFetcher'
|
||||
import createCustomizedFetchFetcher from '@framework/utils/create-customized-fetch-fetcher'
|
||||
import fetch, { Request } from 'node-fetch'
|
||||
|
||||
const createApiFetch: (
|
||||
|
@ -4,12 +4,12 @@ import type { MutationHook } from '@commerce/utils/types'
|
||||
import { useCallback } from 'react'
|
||||
import useCart from './use-cart'
|
||||
import type { AddItemHook } from '@commerce/types/cart'
|
||||
import normalizeCart from '@framework/utils/normalizeCart'
|
||||
import normalizeCart from '@framework/utils/normalize-cart'
|
||||
import type { GraphQLFetcherResult } from '@commerce/api'
|
||||
import type { IOrder } from '@spree/storefront-api-v2-sdk/types/interfaces/Order'
|
||||
import type { IToken } from '@spree/storefront-api-v2-sdk/types/interfaces/Token'
|
||||
import type { AddItem } from '@spree/storefront-api-v2-sdk/types/interfaces/endpoints/CartClass'
|
||||
import getCartToken from '@framework/utils/getCartToken'
|
||||
import getCartToken from '@framework/utils/get-cart-token'
|
||||
|
||||
export default useAddItem as UseAddItem<typeof handler>
|
||||
|
||||
|
@ -3,11 +3,11 @@ import type { SWRHook } from '@commerce/utils/types'
|
||||
import useCart from '@commerce/cart/use-cart'
|
||||
import type { UseCart } from '@commerce/cart/use-cart'
|
||||
import type { GetCartHook } from '@commerce/types/cart'
|
||||
import normalizeCart from '@framework/utils/normalizeCart'
|
||||
import normalizeCart from '@framework/utils/normalize-cart'
|
||||
import type { GraphQLFetcherResult } from '@commerce/api'
|
||||
import type { IOrder } from '@spree/storefront-api-v2-sdk/types/interfaces/Order'
|
||||
import type { IToken } from '@spree/storefront-api-v2-sdk/types/interfaces/Token'
|
||||
import setCartToken from '@framework/utils/setCartToken'
|
||||
import setCartToken from '@framework/utils/set-cart-token'
|
||||
|
||||
export default useCart as UseCart<typeof handler>
|
||||
|
||||
|
@ -4,11 +4,11 @@ import type { UseRemoveItem } from '@commerce/cart/use-remove-item'
|
||||
import type { RemoveItemHook } from '@commerce/types/cart'
|
||||
import useCart from './use-cart'
|
||||
import { useCallback } from 'react'
|
||||
import normalizeCart from '@framework/utils/normalizeCart'
|
||||
import normalizeCart from '@framework/utils/normalize-cart'
|
||||
import type { IOrder } from '@spree/storefront-api-v2-sdk/types/interfaces/Order'
|
||||
import type { GraphQLFetcherResult } from '@commerce/api'
|
||||
import type { IQuery } from '@spree/storefront-api-v2-sdk/types/interfaces/Query'
|
||||
import getCartToken from '@framework/utils/getCartToken'
|
||||
import getCartToken from '@framework/utils/get-cart-token'
|
||||
import type { IToken } from '@spree/storefront-api-v2-sdk/types/interfaces/Token'
|
||||
|
||||
export default useRemoveItem as UseRemoveItem<typeof handler>
|
||||
|
@ -6,10 +6,10 @@ import { useCallback } from 'react'
|
||||
import { ValidationError } from '@commerce/utils/errors'
|
||||
import type { IToken } from '@spree/storefront-api-v2-sdk/types/interfaces/Token'
|
||||
import type { SetQuantity } from '@spree/storefront-api-v2-sdk/types/interfaces/endpoints/CartClass'
|
||||
import getCartToken from '@framework/utils/getCartToken'
|
||||
import getCartToken from '@framework/utils/get-cart-token'
|
||||
import type { GraphQLFetcherResult } from '@commerce/api'
|
||||
import type { IOrder } from '@spree/storefront-api-v2-sdk/types/interfaces/Order'
|
||||
import normalizeCart from '@framework/utils/normalizeCart'
|
||||
import normalizeCart from '@framework/utils/normalize-cart'
|
||||
import debounce from 'lodash.debounce'
|
||||
|
||||
export default useUpdateItem as UseUpdateItem<any>
|
||||
|
@ -1,5 +1,5 @@
|
||||
import type { Fetcher } from '@commerce/utils/types'
|
||||
import convertSpreeErrorToGraphQlError from './utils/convertSpreeErrorToGraphQlError'
|
||||
import convertSpreeErrorToGraphQlError from './utils/convert-spree-error-to-graph-ql-error'
|
||||
import { makeClient } from '@spree/storefront-api-v2-sdk'
|
||||
import type { ResultResponse } from '@spree/storefront-api-v2-sdk/types/interfaces/ResultResponse'
|
||||
import type {
|
||||
@ -7,12 +7,12 @@ import type {
|
||||
JsonApiSingleResponse,
|
||||
} from '@spree/storefront-api-v2-sdk/types/interfaces/JsonApi'
|
||||
import { errors } from '@spree/storefront-api-v2-sdk'
|
||||
import { requireConfigValue } from './isomorphicConfig'
|
||||
import getSpreeSdkMethodFromEndpointPath from './utils/getSpreeSdkMethodFromEndpointPath'
|
||||
import { requireConfigValue } from './isomorphic-config'
|
||||
import getSpreeSdkMethodFromEndpointPath from './utils/get-spree-sdk-method-from-endpoint-path'
|
||||
import SpreeSdkMethodFromEndpointPathError from './errors/SpreeSdkMethodFromEndpointPathError'
|
||||
import type { SpreeSdkVariables } from './types'
|
||||
import type { GraphQLFetcherResult } from '@commerce/api'
|
||||
import createCustomizedFetchFetcher from './utils/createCustomizedFetchFetcher'
|
||||
import createCustomizedFetchFetcher from './utils/create-customized-fetch-fetcher'
|
||||
|
||||
const client = makeClient({
|
||||
host: requireConfigValue('spreeApiHost') as string,
|
||||
|
@ -9,7 +9,7 @@ import {
|
||||
|
||||
import { provider } from './provider'
|
||||
import type { Provider } from './provider'
|
||||
import { requireConfigValue } from './isomorphicConfig'
|
||||
import { requireConfigValue } from './isomorphic-config'
|
||||
|
||||
export type SpreeProps = {
|
||||
children: ReactNode
|
||||
|
@ -1,6 +1,6 @@
|
||||
import forceIsomorphicConfigValues from './utils/forceIsomorphicConfigValues'
|
||||
import requireConfig from './utils/requireConfig'
|
||||
import validateCookieExpire from './utils/validateCookieExpire'
|
||||
import forceIsomorphicConfigValues from './utils/force-isomorphic-config-values'
|
||||
import requireConfig from './utils/require-config'
|
||||
import validateCookieExpire from './utils/validate-cookie-expire'
|
||||
|
||||
const isomorphicConfig = {
|
||||
spreeApiHost: process.env.NEXT_PUBLIC_SPREE_API_HOST,
|
@ -2,12 +2,12 @@ import type { Fetcher, SWRHook } from '@commerce/utils/types'
|
||||
import useSearch from '@commerce/product/use-search'
|
||||
import type { Product, SearchProductsHook } from '@commerce/types/product'
|
||||
import type { UseSearch } from '@commerce/product/use-search'
|
||||
import normalizeProduct from '../utils/normalizeProduct'
|
||||
import normalizeProduct from '../utils/normalize-product'
|
||||
import type { GraphQLFetcherResult } from '@commerce/api'
|
||||
import { IProducts } from '@spree/storefront-api-v2-sdk/types/interfaces/Product'
|
||||
|
||||
const nextToSpreeSortMap: { [key: string]: string } = {
|
||||
'trending-desc': 'updated_at', // Spree has no "trending" filter. Use updated_at.
|
||||
'trending-desc': 'updated_at', // FIXME: Spree has no "trending" filter. Using updated_at.
|
||||
'latest-desc': 'updated_at',
|
||||
'price-asc': 'price',
|
||||
'price-desc': '-price',
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { SpreeProductImage } from '../types'
|
||||
import getImageUrl from './getImageUrl'
|
||||
import getImageUrl from './get-image-url'
|
||||
|
||||
const createGetAbsoluteImageUrl =
|
||||
(host: string) =>
|
@ -8,7 +8,7 @@ import type {
|
||||
} from '@spree/storefront-api-v2-sdk/types/interfaces/JsonApi'
|
||||
import type { RelationType } from '@spree/storefront-api-v2-sdk/types/interfaces/Relationships'
|
||||
import SpreeResponseContentError from '../errors/SpreeResponseContentError'
|
||||
import { findIncluded } from './jsonApi'
|
||||
import { findIncluded } from './find-json-api-documents'
|
||||
|
||||
const isColorProductOption = (productOption: ProductOption) => {
|
||||
return productOption.displayName === 'Color'
|
@ -1,6 +1,6 @@
|
||||
import type { NonUndefined, UnknownObjectValues } from '../types'
|
||||
import MisconfigurationError from '../errors/MisconfigurationError'
|
||||
import isServer from './isServer'
|
||||
import isServer from './is-server'
|
||||
|
||||
const generateMisconfigurationErrorMessage = (
|
||||
keys: Array<string | number | symbol>
|
@ -1,4 +1,4 @@
|
||||
import { requireConfigValue } from '@framework/isomorphicConfig'
|
||||
import { requireConfigValue } from '@framework/isomorphic-config'
|
||||
import Cookies from 'js-cookie'
|
||||
|
||||
const getCartToken = () =>
|
@ -5,7 +5,7 @@ import type {
|
||||
SelectedOption,
|
||||
} from '@commerce/types/cart'
|
||||
import MissingLineItemVariantError from '@framework/errors/MissingLineItemVariantError'
|
||||
import { requireConfigValue } from '@framework/isomorphicConfig'
|
||||
import { requireConfigValue } from '@framework/isomorphic-config'
|
||||
import type {
|
||||
JsonApiDocument,
|
||||
JsonApiListResponse,
|
||||
@ -14,9 +14,9 @@ import type {
|
||||
import type { OrderAttr } from '@spree/storefront-api-v2-sdk/types/interfaces/Order'
|
||||
import { ProductAttr } from '@spree/storefront-api-v2-sdk/types/interfaces/Product'
|
||||
import type { RelationType } from '@spree/storefront-api-v2-sdk/types/interfaces/Relationships'
|
||||
import createGetAbsoluteImageUrl from './createGetAbsoluteImageUrl'
|
||||
import getMediaGallery from './getMediaGallery'
|
||||
import { findIncluded, findIncludedOfType } from './jsonApi'
|
||||
import createGetAbsoluteImageUrl from './create-get-absolute-image-url'
|
||||
import getMediaGallery from './get-media-gallery'
|
||||
import { findIncluded, findIncludedOfType } from './find-json-api-documents'
|
||||
|
||||
const isColorProductOption = (productOptionType: any) => {
|
||||
// TODO: Fix type and merge with isColorProductOption in framework/spree/utils/expandOptions.ts
|
@ -10,11 +10,11 @@ import type {
|
||||
} from '@spree/storefront-api-v2-sdk/types/interfaces/JsonApi'
|
||||
import type { ProductAttr } from '@spree/storefront-api-v2-sdk/types/interfaces/Product'
|
||||
import type { RelationType } from '@spree/storefront-api-v2-sdk/types/interfaces/Relationships'
|
||||
import { requireConfigValue } from '../isomorphicConfig'
|
||||
import createGetAbsoluteImageUrl from './createGetAbsoluteImageUrl'
|
||||
import expandOptions from './expandOptions'
|
||||
import getMediaGallery from './getMediaGallery'
|
||||
import { findIncludedOfType } from './jsonApi'
|
||||
import { requireConfigValue } from '@framework/isomorphic-config'
|
||||
import createGetAbsoluteImageUrl from './create-get-absolute-image-url'
|
||||
import expandOptions from './expand-options'
|
||||
import getMediaGallery from './get-media-gallery'
|
||||
import { findIncludedOfType } from './find-json-api-documents'
|
||||
|
||||
const normalizeProduct = (
|
||||
spreeSuccessResponse: JsonApiSingleResponse | JsonApiListResponse,
|
@ -1,4 +1,4 @@
|
||||
import { requireConfigValue } from '@framework/isomorphicConfig'
|
||||
import { requireConfigValue } from '@framework/isomorphic-config'
|
||||
import Cookies from 'js-cookie'
|
||||
|
||||
const setCartToken = (cartToken: string) => {
|
Loading…
x
Reference in New Issue
Block a user