diff --git a/framework/bigcommerce/product/get-product.ts b/framework/bigcommerce/product/get-product.ts index 7d77eb194..b52568b62 100644 --- a/framework/bigcommerce/product/get-product.ts +++ b/framework/bigcommerce/product/get-product.ts @@ -2,7 +2,7 @@ import type { GetProductQuery, GetProductQueryVariables } from '../schema' import setProductLocaleMeta from '../api/utils/set-product-locale-meta' import { productInfoFragment } from '../api/fragments/product' import { BigcommerceConfig, getConfig } from '../api' -import { normalizeProduct } from '@framework/lib/normalize' +import { normalizeProduct } from '../lib/normalize' import type { Product } from '@commerce/types' export const getProductQuery = /* GraphQL */ ` diff --git a/framework/shopify/api/checkout/index.ts b/framework/shopify/api/checkout/index.ts index d5d6d7f6e..244078466 100644 --- a/framework/shopify/api/checkout/index.ts +++ b/framework/shopify/api/checkout/index.ts @@ -7,10 +7,10 @@ import { SHOPIFY_CHECKOUT_ID_COOKIE, SHOPIFY_CHECKOUT_URL_COOKIE, SHOPIFY_CUSTOMER_TOKEN_COOKIE, -} from '@framework/const' +} from '../../const' import { getConfig } from '..' -import associateCustomerWithCheckoutMutation from '@framework/utils/mutations/associate-customer-with-checkout' +import associateCustomerWithCheckoutMutation from '../../utils/mutations/associate-customer-with-checkout' const METHODS = ['GET'] diff --git a/framework/shopify/api/index.ts b/framework/shopify/api/index.ts index 184d03748..0fe58f2df 100644 --- a/framework/shopify/api/index.ts +++ b/framework/shopify/api/index.ts @@ -5,7 +5,7 @@ import { API_TOKEN, SHOPIFY_CHECKOUT_ID_COOKIE, SHOPIFY_CUSTOMER_TOKEN_COOKIE, -} from '@framework/const' +} from '../const' if (!API_URL) { console.log(process.env) diff --git a/framework/shopify/api/utils/fetch-all-products.ts b/framework/shopify/api/utils/fetch-all-products.ts index efeb809f1..9fa70a5ee 100644 --- a/framework/shopify/api/utils/fetch-all-products.ts +++ b/framework/shopify/api/utils/fetch-all-products.ts @@ -1,4 +1,4 @@ -import { ProductEdge } from '@framework/schema' +import { ProductEdge } from '../../schema' import { ShopifyConfig } from '..' const fetchAllProducts = async ({ diff --git a/framework/shopify/api/utils/fetch-graphql-api.ts b/framework/shopify/api/utils/fetch-graphql-api.ts index 92d4f2cf6..321cba2aa 100644 --- a/framework/shopify/api/utils/fetch-graphql-api.ts +++ b/framework/shopify/api/utils/fetch-graphql-api.ts @@ -2,7 +2,7 @@ import type { GraphQLFetcher } from '@commerce/api' import fetch from './fetch' import { API_URL, API_TOKEN } from '../../const' -import { getError } from '@framework/utils/handle-fetch-response' +import { getError } from '../../utils/handle-fetch-response' const fetchGraphqlApi: GraphQLFetcher = async ( query: string, diff --git a/framework/shopify/auth/use-login.tsx b/framework/shopify/auth/use-login.tsx index 32dd91920..188dd54a2 100644 --- a/framework/shopify/auth/use-login.tsx +++ b/framework/shopify/auth/use-login.tsx @@ -8,9 +8,9 @@ import { CustomerUserError, Mutation, MutationCheckoutCreateArgs, -} from '@framework/schema' +} from '../schema' import useLogin, { UseLogin } from '@commerce/auth/use-login' -import { setCustomerToken } from '@framework/utils' +import { setCustomerToken } from '../utils' export default useLogin as UseLogin diff --git a/framework/shopify/auth/use-logout.tsx b/framework/shopify/auth/use-logout.tsx index ccbeb8166..81a3b8cdd 100644 --- a/framework/shopify/auth/use-logout.tsx +++ b/framework/shopify/auth/use-logout.tsx @@ -2,11 +2,8 @@ import { useCallback } from 'react' import type { MutationHook } from '@commerce/utils/types' import useLogout, { UseLogout } from '@commerce/auth/use-logout' import useCustomer from '../customer/use-customer' -import customerAccessTokenDeleteMutation from '@framework/utils/mutations/customer-access-token-delete' -import { - getCustomerToken, - setCustomerToken, -} from '@framework/utils/customer-token' +import customerAccessTokenDeleteMutation from '../utils/mutations/customer-access-token-delete' +import { getCustomerToken, setCustomerToken } from '../utils/customer-token' export default useLogout as UseLogout diff --git a/framework/shopify/auth/use-signup.tsx b/framework/shopify/auth/use-signup.tsx index f072f1925..7f66448d3 100644 --- a/framework/shopify/auth/use-signup.tsx +++ b/framework/shopify/auth/use-signup.tsx @@ -3,13 +3,13 @@ import type { MutationHook } from '@commerce/utils/types' import { CommerceError } from '@commerce/utils/errors' import useSignup, { UseSignup } from '@commerce/auth/use-signup' import useCustomer from '../customer/use-customer' -import { CustomerCreateInput } from '@framework/schema' +import { CustomerCreateInput } from '../schema' import { customerCreateMutation, customerAccessTokenCreateMutation, -} from '@framework/utils/mutations' -import handleLogin from '@framework/utils/handle-login' +} from '../utils/mutations' +import handleLogin from '../utils/handle-login' export default useSignup as UseSignup diff --git a/framework/shopify/cart/use-remove-item.tsx b/framework/shopify/cart/use-remove-item.tsx index 1963176c8..e2aef13d8 100644 --- a/framework/shopify/cart/use-remove-item.tsx +++ b/framework/shopify/cart/use-remove-item.tsx @@ -13,13 +13,10 @@ import useRemoveItem, { } from '@commerce/cart/use-remove-item' import useCart from './use-cart' -import { checkoutLineItemRemoveMutation, getCheckoutId } from '@framework/utils' +import { checkoutLineItemRemoveMutation, getCheckoutId } from '../utils' import { checkoutToCart } from './utils' -import { Cart, LineItem } from '@framework/types' -import { - Mutation, - MutationCheckoutLineItemsRemoveArgs, -} from '@framework/schema' +import { Cart, LineItem } from '../types' +import { Mutation, MutationCheckoutLineItemsRemoveArgs } from '../schema' import { RemoveCartItemBody } from '@commerce/types' export type RemoveItemFn = T extends LineItem diff --git a/framework/shopify/cart/use-update-item.tsx b/framework/shopify/cart/use-update-item.tsx index 9e89d0aca..666ce3d08 100644 --- a/framework/shopify/cart/use-update-item.tsx +++ b/framework/shopify/cart/use-update-item.tsx @@ -15,10 +15,7 @@ import { handler as removeItemHandler } from './use-remove-item' import type { Cart, LineItem, UpdateCartItemBody } from '../types' import { checkoutToCart } from './utils' import { getCheckoutId, checkoutLineItemUpdateMutation } from '../utils' -import { - Mutation, - MutationCheckoutLineItemsUpdateArgs, -} from '@framework/schema' +import { Mutation, MutationCheckoutLineItemsUpdateArgs } from '../schema' export type UpdateItemInput = T extends LineItem ? Partial> diff --git a/framework/shopify/cart/utils/checkout-create.ts b/framework/shopify/cart/utils/checkout-create.ts index 0e71be62f..6c4f81c21 100644 --- a/framework/shopify/cart/utils/checkout-create.ts +++ b/framework/shopify/cart/utils/checkout-create.ts @@ -1,9 +1,9 @@ import { SHOPIFY_CHECKOUT_ID_COOKIE, SHOPIFY_CHECKOUT_URL_COOKIE, -} from '@framework/const' +} from '../../const' -import checkoutCreateMutation from '@framework/utils/mutations/checkout-create' +import checkoutCreateMutation from '../../utils/mutations/checkout-create' import Cookies from 'js-cookie' export const checkoutCreate = async (fetch: any) => { diff --git a/framework/shopify/cart/utils/checkout-to-cart.ts b/framework/shopify/cart/utils/checkout-to-cart.ts index 662db1c45..fa8b988f9 100644 --- a/framework/shopify/cart/utils/checkout-to-cart.ts +++ b/framework/shopify/cart/utils/checkout-to-cart.ts @@ -6,8 +6,8 @@ import { CheckoutLineItemsRemovePayload, CheckoutLineItemsUpdatePayload, Maybe, -} from '@framework/schema' -import { normalizeCart } from '@framework/utils' +} from '../../schema' +import { normalizeCart } from '../../utils' export type CheckoutPayload = | CheckoutLineItemsAddPayload diff --git a/framework/shopify/common/get-site-info.ts b/framework/shopify/common/get-site-info.ts index f6cdaad85..cbbacf5b6 100644 --- a/framework/shopify/common/get-site-info.ts +++ b/framework/shopify/common/get-site-info.ts @@ -1,5 +1,5 @@ -import getCategories, { Category } from '@framework/utils/get-categories' -import getVendors, { Brands } from '@framework/utils/get-vendors' +import getCategories, { Category } from '../utils/get-categories' +import getVendors, { Brands } from '../utils/get-vendors' import { getConfig, ShopifyConfig } from '../api' diff --git a/framework/shopify/customer/get-customer-id.ts b/framework/shopify/customer/get-customer-id.ts index 78309a8ec..ca096645a 100644 --- a/framework/shopify/customer/get-customer-id.ts +++ b/framework/shopify/customer/get-customer-id.ts @@ -1,5 +1,5 @@ -import { getConfig, ShopifyConfig } from '@framework/api' -import getCustomerIdQuery from '@framework/utils/queries/get-customer-id-query' +import { getConfig, ShopifyConfig } from '../api' +import getCustomerIdQuery from '../utils/queries/get-customer-id-query' import Cookies from 'js-cookie' async function getCustomerId({ diff --git a/framework/shopify/product/get-all-collections.ts b/framework/shopify/product/get-all-collections.ts index bf3fee392..15c4bc51a 100644 --- a/framework/shopify/product/get-all-collections.ts +++ b/framework/shopify/product/get-all-collections.ts @@ -1,4 +1,4 @@ -import { CollectionEdge } from '@framework/schema' +import { CollectionEdge } from '../schema' import { getConfig, ShopifyConfig } from '../api' import getAllCollectionsQuery from '../utils/queries/get-all-collections-query' diff --git a/framework/shopify/product/get-all-products.ts b/framework/shopify/product/get-all-products.ts index e1eb96aac..14e486563 100644 --- a/framework/shopify/product/get-all-products.ts +++ b/framework/shopify/product/get-all-products.ts @@ -2,7 +2,7 @@ import { GraphQLFetcherResult } from '@commerce/api' import { getConfig, ShopifyConfig } from '../api' import { ProductEdge } from '../schema' import { getAllProductsQuery } from '../utils/queries' -import { normalizeProduct } from '@framework/utils/normalize' +import { normalizeProduct } from '../utils/normalize' import { Product } from '@commerce/types' type Variables = { diff --git a/framework/shopify/product/use-search.tsx b/framework/shopify/product/use-search.tsx index 7ca37916b..4b14249ca 100644 --- a/framework/shopify/product/use-search.tsx +++ b/framework/shopify/product/use-search.tsx @@ -1,17 +1,16 @@ import { SWRHook } from '@commerce/utils/types' import useSearch, { UseSearch } from '@commerce/product/use-search' -import { ProductEdge } from '@framework/schema' +import { ProductEdge } from '../schema' import { getAllProductsQuery, getSearchVariables, normalizeProduct, -} from '@framework/utils' -import type { ShopifyProvider } from '..' +} from '../utils' import { Product } from '@commerce/types' -export default useSearch as UseSearch +export default useSearch as UseSearch export type SearchProductsInput = { search?: string @@ -40,7 +39,10 @@ export const handler: SWRHook< }) const edges = resp.products?.edges return { - products: edges?.map(({ node: p }: ProductEdge) => normalizeProduct(p)), + products: edges?.map(({ node: p }: ProductEdge) => + // TODO: Fix this product type + normalizeProduct(p as any) + ), found: !!edges?.length, } }, diff --git a/framework/shopify/utils/get-categories.ts b/framework/shopify/utils/get-categories.ts index 942ec9c62..e1176b068 100644 --- a/framework/shopify/utils/get-categories.ts +++ b/framework/shopify/utils/get-categories.ts @@ -1,5 +1,5 @@ -import { ShopifyConfig } from '@framework/api' -import { CollectionEdge } from '@framework/schema' +import { ShopifyConfig } from '../api' +import { CollectionEdge } from '../schema' import getSiteCollectionsQuery from './queries/get-all-collections-query' export type Category = { diff --git a/framework/shopify/utils/get-search-variables.ts b/framework/shopify/utils/get-search-variables.ts index 90d35ba50..6f5d08b1a 100644 --- a/framework/shopify/utils/get-search-variables.ts +++ b/framework/shopify/utils/get-search-variables.ts @@ -1,5 +1,5 @@ import getSortVariables from './get-sort-variables' -import type { SearchProductsInput } from '@framework/product/use-search' +import type { SearchProductsInput } from '../product/use-search' export const getSearchVariables = ({ categoryId, diff --git a/framework/shopify/utils/get-vendors.ts b/framework/shopify/utils/get-vendors.ts index d3ebce194..f04483bb1 100644 --- a/framework/shopify/utils/get-vendors.ts +++ b/framework/shopify/utils/get-vendors.ts @@ -1,5 +1,5 @@ -import { ShopifyConfig } from '@framework/api' -import fetchAllProducts from '@framework/api/utils/fetch-all-products' +import { ShopifyConfig } from '../api' +import fetchAllProducts from '../api/utils/fetch-all-products' import getAllProductVendors from './queries/get-all-product-vendors-query' export type BrandNode = { diff --git a/framework/shopify/utils/normalize.ts b/framework/shopify/utils/normalize.ts index 1eee9f336..67ab3a8a2 100644 --- a/framework/shopify/utils/normalize.ts +++ b/framework/shopify/utils/normalize.ts @@ -7,7 +7,7 @@ import { ProductVariantConnection, ProductOption, MoneyV2, -} from '@framework/schema' +} from '../schema' import type { Cart, LineItem } from '../types'