feat(main): refactoring

This commit is contained in:
oybek 2024-04-01 20:01:06 +04:00
parent bc23896efc
commit 4d28219362
5 changed files with 8 additions and 8 deletions

View File

@ -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

View File

@ -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;

View File

@ -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,

View File

@ -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';

View File

@ -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
}
});