Remove references to @framework and use relative paths instead

This commit is contained in:
tniezg 2021-08-30 12:27:15 +02:00
parent c86915080e
commit 490f94b515
15 changed files with 27 additions and 31 deletions

View File

@ -3,8 +3,8 @@ import type { CommerceAPI } from '@commerce/api'
import type { GetAPISchema } from '@commerce/api'
import checkoutEndpoint from '@commerce/api/endpoints/checkout'
import type { CheckoutSchema } from '@commerce/types/checkout'
import type { SpreeApiProvider } from '@framework/api'
import checkout from './checkout'
import { SpreeApiProvider } from '../..'
export type CheckoutAPI = GetAPISchema<
CommerceAPI<SpreeApiProvider>,

View File

@ -4,9 +4,9 @@ import type {
} from '@commerce/api/operations'
import type { Product } from '@commerce/types/product'
import type { GetAllProductPathsOperation } from '@commerce/types/product'
import { requireConfigValue } from '@framework/isomorphic-config'
import type { IProductsSlugs, SpreeSdkVariables } from '@framework/types'
import getProductPath from '@framework/utils/get-product-path'
import { requireConfigValue } from '../../isomorphic-config'
import type { IProductsSlugs, SpreeSdkVariables } from '../../types'
import getProductPath from '../../utils/get-product-path'
import type { SpreeApiConfig, SpreeApiProvider } from '..'
export default function getAllProductPathsOperation({

View File

@ -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/utils/normalize-product'
import normalizeProduct from '../../utils/normalize-product'
export default function getAllProductsOperation({
commerce,

View File

@ -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/utils/normalize-product'
import normalizeProduct from '../../utils/normalize-product'
export default function getProductOperation({
commerce,

View File

@ -7,7 +7,7 @@ import type {
ITaxons,
TaxonAttr,
} from '@spree/storefront-api-v2-sdk/types/interfaces/Taxon'
import { requireConfigValue } from '@framework/isomorphic-config'
import { requireConfigValue } from '../../isomorphic-config'
import type { SpreeSdkVariables } from 'framework/spree/types'
import type { SpreeApiConfig, SpreeApiProvider } from '..'

View File

@ -1,17 +1,17 @@
import { SpreeApiConfig } from '..'
import { errors, makeClient } from '@spree/storefront-api-v2-sdk'
import { requireConfigValue } from '@framework/isomorphic-config'
import convertSpreeErrorToGraphQlError from '@framework/utils/convert-spree-error-to-graph-ql-error'
import { requireConfigValue } from '../../isomorphic-config'
import convertSpreeErrorToGraphQlError from '../../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/utils/get-spree-sdk-method-from-endpoint-path'
import getSpreeSdkMethodFromEndpointPath from '../../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 '@framework/utils/create-customized-fetch-fetcher'
import createCustomizedFetchFetcher from '../../utils/create-customized-fetch-fetcher'
import fetch, { Request } from 'node-fetch'
const createApiFetch: (

View File

@ -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/normalize-cart'
import normalizeCart from '../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/get-cart-token'
import getCartToken from '../utils/get-cart-token'
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 type { UseCart } from '@commerce/cart/use-cart'
import type { GetCartHook } from '@commerce/types/cart'
import normalizeCart from '@framework/utils/normalize-cart'
import normalizeCart from '../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/set-cart-token'
import setCartToken from '../utils/set-cart-token'
import { FetcherError } from '@commerce/utils/errors'
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 useCart from './use-cart'
import { useCallback } from 'react'
import normalizeCart from '@framework/utils/normalize-cart'
import normalizeCart from '../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/get-cart-token'
import getCartToken from '../utils/get-cart-token'
import type { IToken } from '@spree/storefront-api-v2-sdk/types/interfaces/Token'
export default useRemoveItem as UseRemoveItem<typeof handler>

View File

@ -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/get-cart-token'
import getCartToken from '../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/normalize-cart'
import normalizeCart from '../utils/normalize-cart'
import debounce from 'lodash.debounce'
export default useUpdateItem as UseUpdateItem<any>

View File

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

View File

@ -1,4 +1,4 @@
import type { ProductSlugAttr } from '@framework/types'
import type { ProductSlugAttr } from '../types'
const getProductPath = (partialSpreeProduct: ProductSlugAttr): string => {
return `/${partialSpreeProduct.attributes.slug}`

View File

@ -4,8 +4,8 @@ import type {
ProductVariant,
SelectedOption,
} from '@commerce/types/cart'
import MissingLineItemVariantError from '@framework/errors/MissingLineItemVariantError'
import { requireConfigValue } from '@framework/isomorphic-config'
import MissingLineItemVariantError from '../errors/MissingLineItemVariantError'
import { requireConfigValue } from '../isomorphic-config'
import type {
JsonApiListResponse,
JsonApiSingleResponse,
@ -16,11 +16,7 @@ import type { RelationType } from '@spree/storefront-api-v2-sdk/types/interfaces
import createGetAbsoluteImageUrl from './create-get-absolute-image-url'
import getMediaGallery from './get-media-gallery'
import { findIncluded, findIncludedOfType } from './find-json-api-documents'
import type {
LineItemAttr,
OptionTypeAttr,
VariantAttr,
} from '@framework/types'
import type { LineItemAttr, OptionTypeAttr, VariantAttr } from '../types'
import type { Image } from '@commerce/types/common'
const placeholderImage = requireConfigValue('lineItemPlaceholderImageUrl') as

View File

@ -11,13 +11,13 @@ 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 '@framework/isomorphic-config'
import { requireConfigValue } from '../isomorphic-config'
import createGetAbsoluteImageUrl from './create-get-absolute-image-url'
import expandOptions from './expand-options'
import getMediaGallery from './get-media-gallery'
import { findIncluded, findIncludedOfType } from './find-json-api-documents'
import getProductPath from './get-product-path'
import MissingPrimaryVariantError from '@framework/errors/MissingPrimaryVariantError'
import MissingPrimaryVariantError from '../errors/MissingPrimaryVariantError'
const placeholderImage = requireConfigValue('productPlaceholderImageUrl') as
| string

View File

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