mirror of
https://github.com/vercel/commerce.git
synced 2025-05-12 12:47:50 +00:00
feat(main): refactoring
This commit is contained in:
parent
bc23896efc
commit
4d28219362
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
|
@ -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';
|
||||
|
@ -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
|
||||
}
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user