diff --git a/app/layout.tsx b/app/layout.tsx index 2b6c434a8..d6dd4e23d 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -1,9 +1,9 @@ import Navbar from 'components/layout/navbar'; import { GeistSans } from 'geist/font'; +import ShopifyAnalytics from 'components/layout/shopify-analytics'; import { ensureStartsWith } from 'lib/utils'; import { ReactNode, Suspense } from 'react'; import './globals.css'; -import ShopifyAnalytics from 'components/layout/shopify-analytics'; const { TWITTER_CREATOR, TWITTER_SITE, SITE_NAME } = process.env; const baseUrl = process.env.NEXT_PUBLIC_VERCEL_URL diff --git a/components/cart/actions.ts b/components/cart/actions.ts index 172b94bf1..0da2f5f37 100644 --- a/components/cart/actions.ts +++ b/components/cart/actions.ts @@ -5,7 +5,7 @@ import { addToCart, createCart, getCart, removeFromCart, updateCart } from 'lib/ import { revalidateTag } from 'next/cache'; import { cookies } from 'next/headers'; import { ShopifyAnalyticsProduct } from '@shopify/hydrogen-react'; -import { productToAnalytics } from '../../lib/utils'; +import { productToAnalytics } from 'lib/utils'; type AddItemResponse = { cartId?: string; diff --git a/components/cart/add-to-cart.tsx b/components/cart/add-to-cart.tsx index da5cf9fe2..1f9e632ec 100644 --- a/components/cart/add-to-cart.tsx +++ b/components/cart/add-to-cart.tsx @@ -8,7 +8,7 @@ import { ProductVariant } from 'lib/shopify/types'; import { useSearchParams } from 'next/navigation'; import { useFormState, useFormStatus } from 'react-dom'; import { useEffect } from 'react'; -import { useShopifyAnalytics } from '../../lib/shopify/hooks/use-shopify-analytics'; +import { useShopifyAnalytics } from 'lib/shopify/hooks/use-shopify-analytics'; function SubmitButton({ availableForSale, diff --git a/lib/constants.ts b/lib/constants.ts index c31f0aff9..13efe4d30 100644 --- a/lib/constants.ts +++ b/lib/constants.ts @@ -30,7 +30,7 @@ export const HIDDEN_PRODUCT_TAG = 'nextjs-frontend-hidden'; export const DEFAULT_OPTION = 'Default Title'; export const SHOPIFY_GRAPHQL_API_ENDPOINT = '/api/2023-01/graphql.json'; -export const currency = 'AED'; +export const DEFAULT_CURRENCY = 'AED'; // use your logic to get language -export const defaultLanguage = 'EN'; +export const DEFAULT_LANGUAGE = 'EN'; diff --git a/lib/shopify/hooks/use-shopify-analytics.ts b/lib/shopify/hooks/use-shopify-analytics.ts index f97899768..07de17f8a 100644 --- a/lib/shopify/hooks/use-shopify-analytics.ts +++ b/lib/shopify/hooks/use-shopify-analytics.ts @@ -8,7 +8,7 @@ import { ShopifySalesChannel, useShopifyCookies } from '@shopify/hydrogen-react'; -import { currency, defaultLanguage } from 'lib/constants'; +import { DEFAULT_CURRENCY, DEFAULT_LANGUAGE } from 'lib/constants'; const SHOP_ID = process.env.NEXT_PUBLIC_SHOPIFY_SHOP_ID!; @@ -41,8 +41,8 @@ export function useShopifyAnalytics() { hasUserConsent: true, shopifySalesChannel: ShopifySalesChannel.headless, shopId: `gid://shopify/Shop/${SHOP_ID}`, - currency, - acceptedLanguage: defaultLanguage, + currency: DEFAULT_CURRENCY, + acceptedLanguage: DEFAULT_LANGUAGE, ...payload } });