Use kebab case instead of camel case

This commit is contained in:
tniezg 2021-08-18 18:14:49 +02:00
parent 17f8d497b8
commit c150a79a6b
28 changed files with 39 additions and 39 deletions

View File

@ -7,7 +7,7 @@ import type {
import type { IProducts } from '@spree/storefront-api-v2-sdk/types/interfaces/Product' import type { IProducts } from '@spree/storefront-api-v2-sdk/types/interfaces/Product'
import type { SpreeApiConfig, SpreeApiProvider } from '../index' import type { SpreeApiConfig, SpreeApiProvider } from '../index'
import type { SpreeSdkVariables } from 'framework/spree/types' 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({ export default function getAllProductsOperation({
commerce, commerce,

View File

@ -7,7 +7,7 @@ import type {
import type { IProduct } from '@spree/storefront-api-v2-sdk/types/interfaces/Product' import type { IProduct } from '@spree/storefront-api-v2-sdk/types/interfaces/Product'
import type { SpreeSdkVariables } from 'framework/spree/types' import type { SpreeSdkVariables } from 'framework/spree/types'
import MissingSlugVariableError from 'framework/spree/errors/MissingSlugVariableError' 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({ export default function getProductOperation({
commerce, commerce,

View File

@ -7,7 +7,7 @@ import type {
ITaxons, ITaxons,
TaxonAttr, TaxonAttr,
} from '@spree/storefront-api-v2-sdk/types/interfaces/Taxon' } 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 { SpreeSdkVariables } from 'framework/spree/types'
import type { SpreeApiConfig, SpreeApiProvider } from '..' import type { SpreeApiConfig, SpreeApiProvider } from '..'

View File

@ -1,17 +1,17 @@
import { SpreeApiConfig } from '..' import { SpreeApiConfig } from '..'
import { errors, makeClient } from '@spree/storefront-api-v2-sdk' import { errors, makeClient } from '@spree/storefront-api-v2-sdk'
import { requireConfigValue } from 'framework/spree/isomorphicConfig' import { requireConfigValue } from '@framework/isomorphic-config'
import convertSpreeErrorToGraphQlError from 'framework/spree/utils/convertSpreeErrorToGraphQlError' 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 { ResultResponse } from '@spree/storefront-api-v2-sdk/types/interfaces/ResultResponse'
import type { import type {
JsonApiListResponse, JsonApiListResponse,
JsonApiSingleResponse, JsonApiSingleResponse,
} from '@spree/storefront-api-v2-sdk/types/interfaces/JsonApi' } 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 { SpreeSdkVariables } from 'framework/spree/types'
import SpreeSdkMethodFromEndpointPathError from 'framework/spree/errors/SpreeSdkMethodFromEndpointPathError' import SpreeSdkMethodFromEndpointPathError from 'framework/spree/errors/SpreeSdkMethodFromEndpointPathError'
import { GraphQLFetcher, GraphQLFetcherResult } from '@commerce/api' 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' import fetch, { Request } from 'node-fetch'
const createApiFetch: ( const createApiFetch: (

View File

@ -4,12 +4,12 @@ import type { MutationHook } from '@commerce/utils/types'
import { useCallback } from 'react' import { useCallback } from 'react'
import useCart from './use-cart' import useCart from './use-cart'
import type { AddItemHook } from '@commerce/types/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 { GraphQLFetcherResult } from '@commerce/api'
import type { IOrder } from '@spree/storefront-api-v2-sdk/types/interfaces/Order' 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 { IToken } from '@spree/storefront-api-v2-sdk/types/interfaces/Token'
import type { AddItem } from '@spree/storefront-api-v2-sdk/types/interfaces/endpoints/CartClass' 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> export default useAddItem as UseAddItem<typeof handler>

View File

@ -3,11 +3,11 @@ import type { SWRHook } from '@commerce/utils/types'
import useCart from '@commerce/cart/use-cart' import useCart from '@commerce/cart/use-cart'
import type { UseCart } from '@commerce/cart/use-cart' import type { UseCart } from '@commerce/cart/use-cart'
import type { GetCartHook } from '@commerce/types/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 { GraphQLFetcherResult } from '@commerce/api'
import type { IOrder } from '@spree/storefront-api-v2-sdk/types/interfaces/Order' 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 { 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> export default useCart as UseCart<typeof handler>

View File

@ -4,11 +4,11 @@ import type { UseRemoveItem } from '@commerce/cart/use-remove-item'
import type { RemoveItemHook } from '@commerce/types/cart' import type { RemoveItemHook } from '@commerce/types/cart'
import useCart from './use-cart' import useCart from './use-cart'
import { useCallback } from 'react' 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 { IOrder } from '@spree/storefront-api-v2-sdk/types/interfaces/Order'
import type { GraphQLFetcherResult } from '@commerce/api' import type { GraphQLFetcherResult } from '@commerce/api'
import type { IQuery } from '@spree/storefront-api-v2-sdk/types/interfaces/Query' 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' import type { IToken } from '@spree/storefront-api-v2-sdk/types/interfaces/Token'
export default useRemoveItem as UseRemoveItem<typeof handler> export default useRemoveItem as UseRemoveItem<typeof handler>

View File

@ -6,10 +6,10 @@ import { useCallback } from 'react'
import { ValidationError } from '@commerce/utils/errors' import { ValidationError } from '@commerce/utils/errors'
import type { IToken } from '@spree/storefront-api-v2-sdk/types/interfaces/Token' 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 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 { GraphQLFetcherResult } from '@commerce/api'
import type { IOrder } from '@spree/storefront-api-v2-sdk/types/interfaces/Order' 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' import debounce from 'lodash.debounce'
export default useUpdateItem as UseUpdateItem<any> export default useUpdateItem as UseUpdateItem<any>

View File

@ -1,5 +1,5 @@
import type { Fetcher } from '@commerce/utils/types' 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 { makeClient } from '@spree/storefront-api-v2-sdk'
import type { ResultResponse } from '@spree/storefront-api-v2-sdk/types/interfaces/ResultResponse' import type { ResultResponse } from '@spree/storefront-api-v2-sdk/types/interfaces/ResultResponse'
import type { import type {
@ -7,12 +7,12 @@ import type {
JsonApiSingleResponse, JsonApiSingleResponse,
} from '@spree/storefront-api-v2-sdk/types/interfaces/JsonApi' } from '@spree/storefront-api-v2-sdk/types/interfaces/JsonApi'
import { errors } from '@spree/storefront-api-v2-sdk' import { errors } from '@spree/storefront-api-v2-sdk'
import { requireConfigValue } from './isomorphicConfig' import { requireConfigValue } from './isomorphic-config'
import getSpreeSdkMethodFromEndpointPath from './utils/getSpreeSdkMethodFromEndpointPath' import getSpreeSdkMethodFromEndpointPath from './utils/get-spree-sdk-method-from-endpoint-path'
import SpreeSdkMethodFromEndpointPathError from './errors/SpreeSdkMethodFromEndpointPathError' import SpreeSdkMethodFromEndpointPathError from './errors/SpreeSdkMethodFromEndpointPathError'
import type { SpreeSdkVariables } from './types' import type { SpreeSdkVariables } from './types'
import type { GraphQLFetcherResult } from '@commerce/api' import type { GraphQLFetcherResult } from '@commerce/api'
import createCustomizedFetchFetcher from './utils/createCustomizedFetchFetcher' import createCustomizedFetchFetcher from './utils/create-customized-fetch-fetcher'
const client = makeClient({ const client = makeClient({
host: requireConfigValue('spreeApiHost') as string, host: requireConfigValue('spreeApiHost') as string,

View File

@ -9,7 +9,7 @@ import {
import { provider } from './provider' import { provider } from './provider'
import type { Provider } from './provider' import type { Provider } from './provider'
import { requireConfigValue } from './isomorphicConfig' import { requireConfigValue } from './isomorphic-config'
export type SpreeProps = { export type SpreeProps = {
children: ReactNode children: ReactNode

View File

@ -1,6 +1,6 @@
import forceIsomorphicConfigValues from './utils/forceIsomorphicConfigValues' import forceIsomorphicConfigValues from './utils/force-isomorphic-config-values'
import requireConfig from './utils/requireConfig' import requireConfig from './utils/require-config'
import validateCookieExpire from './utils/validateCookieExpire' import validateCookieExpire from './utils/validate-cookie-expire'
const isomorphicConfig = { const isomorphicConfig = {
spreeApiHost: process.env.NEXT_PUBLIC_SPREE_API_HOST, spreeApiHost: process.env.NEXT_PUBLIC_SPREE_API_HOST,

View File

@ -2,12 +2,12 @@ import type { Fetcher, SWRHook } from '@commerce/utils/types'
import useSearch from '@commerce/product/use-search' import useSearch from '@commerce/product/use-search'
import type { Product, SearchProductsHook } from '@commerce/types/product' import type { Product, SearchProductsHook } from '@commerce/types/product'
import type { UseSearch } from '@commerce/product/use-search' 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 type { GraphQLFetcherResult } from '@commerce/api'
import { IProducts } from '@spree/storefront-api-v2-sdk/types/interfaces/Product' import { IProducts } from '@spree/storefront-api-v2-sdk/types/interfaces/Product'
const nextToSpreeSortMap: { [key: string]: string } = { 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', 'latest-desc': 'updated_at',
'price-asc': 'price', 'price-asc': 'price',
'price-desc': '-price', 'price-desc': '-price',

View File

@ -1,5 +1,5 @@
import { SpreeProductImage } from '../types' import { SpreeProductImage } from '../types'
import getImageUrl from './getImageUrl' import getImageUrl from './get-image-url'
const createGetAbsoluteImageUrl = const createGetAbsoluteImageUrl =
(host: string) => (host: string) =>

View File

@ -8,7 +8,7 @@ import type {
} from '@spree/storefront-api-v2-sdk/types/interfaces/JsonApi' } from '@spree/storefront-api-v2-sdk/types/interfaces/JsonApi'
import type { RelationType } from '@spree/storefront-api-v2-sdk/types/interfaces/Relationships' import type { RelationType } from '@spree/storefront-api-v2-sdk/types/interfaces/Relationships'
import SpreeResponseContentError from '../errors/SpreeResponseContentError' import SpreeResponseContentError from '../errors/SpreeResponseContentError'
import { findIncluded } from './jsonApi' import { findIncluded } from './find-json-api-documents'
const isColorProductOption = (productOption: ProductOption) => { const isColorProductOption = (productOption: ProductOption) => {
return productOption.displayName === 'Color' return productOption.displayName === 'Color'

View File

@ -1,6 +1,6 @@
import type { NonUndefined, UnknownObjectValues } from '../types' import type { NonUndefined, UnknownObjectValues } from '../types'
import MisconfigurationError from '../errors/MisconfigurationError' import MisconfigurationError from '../errors/MisconfigurationError'
import isServer from './isServer' import isServer from './is-server'
const generateMisconfigurationErrorMessage = ( const generateMisconfigurationErrorMessage = (
keys: Array<string | number | symbol> keys: Array<string | number | symbol>

View File

@ -1,4 +1,4 @@
import { requireConfigValue } from '@framework/isomorphicConfig' import { requireConfigValue } from '@framework/isomorphic-config'
import Cookies from 'js-cookie' import Cookies from 'js-cookie'
const getCartToken = () => const getCartToken = () =>

View File

@ -5,7 +5,7 @@ import type {
SelectedOption, SelectedOption,
} from '@commerce/types/cart' } from '@commerce/types/cart'
import MissingLineItemVariantError from '@framework/errors/MissingLineItemVariantError' import MissingLineItemVariantError from '@framework/errors/MissingLineItemVariantError'
import { requireConfigValue } from '@framework/isomorphicConfig' import { requireConfigValue } from '@framework/isomorphic-config'
import type { import type {
JsonApiDocument, JsonApiDocument,
JsonApiListResponse, JsonApiListResponse,
@ -14,9 +14,9 @@ import type {
import type { OrderAttr } from '@spree/storefront-api-v2-sdk/types/interfaces/Order' import type { OrderAttr } from '@spree/storefront-api-v2-sdk/types/interfaces/Order'
import { ProductAttr } from '@spree/storefront-api-v2-sdk/types/interfaces/Product' import { ProductAttr } from '@spree/storefront-api-v2-sdk/types/interfaces/Product'
import type { RelationType } from '@spree/storefront-api-v2-sdk/types/interfaces/Relationships' import type { RelationType } from '@spree/storefront-api-v2-sdk/types/interfaces/Relationships'
import createGetAbsoluteImageUrl from './createGetAbsoluteImageUrl' import createGetAbsoluteImageUrl from './create-get-absolute-image-url'
import getMediaGallery from './getMediaGallery' import getMediaGallery from './get-media-gallery'
import { findIncluded, findIncludedOfType } from './jsonApi' import { findIncluded, findIncludedOfType } from './find-json-api-documents'
const isColorProductOption = (productOptionType: any) => { const isColorProductOption = (productOptionType: any) => {
// TODO: Fix type and merge with isColorProductOption in framework/spree/utils/expandOptions.ts // TODO: Fix type and merge with isColorProductOption in framework/spree/utils/expandOptions.ts

View File

@ -10,11 +10,11 @@ import type {
} from '@spree/storefront-api-v2-sdk/types/interfaces/JsonApi' } from '@spree/storefront-api-v2-sdk/types/interfaces/JsonApi'
import type { ProductAttr } from '@spree/storefront-api-v2-sdk/types/interfaces/Product' 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 type { RelationType } from '@spree/storefront-api-v2-sdk/types/interfaces/Relationships'
import { requireConfigValue } from '../isomorphicConfig' import { requireConfigValue } from '@framework/isomorphic-config'
import createGetAbsoluteImageUrl from './createGetAbsoluteImageUrl' import createGetAbsoluteImageUrl from './create-get-absolute-image-url'
import expandOptions from './expandOptions' import expandOptions from './expand-options'
import getMediaGallery from './getMediaGallery' import getMediaGallery from './get-media-gallery'
import { findIncludedOfType } from './jsonApi' import { findIncludedOfType } from './find-json-api-documents'
const normalizeProduct = ( const normalizeProduct = (
spreeSuccessResponse: JsonApiSingleResponse | JsonApiListResponse, spreeSuccessResponse: JsonApiSingleResponse | JsonApiListResponse,

View File

@ -1,4 +1,4 @@
import { requireConfigValue } from '@framework/isomorphicConfig' import { requireConfigValue } from '@framework/isomorphic-config'
import Cookies from 'js-cookie' import Cookies from 'js-cookie'
const setCartToken = (cartToken: string) => { const setCartToken = (cartToken: string) => {