diff --git a/apps/haqq-website/constants.ts b/apps/haqq-website/constants.ts index 3b871989d..a2a0db28d 100644 --- a/apps/haqq-website/constants.ts +++ b/apps/haqq-website/constants.ts @@ -10,8 +10,3 @@ export const TURNSTILE_SITEKEY = process.env['TURNSTILE_SITEKEY']; export const NX_WALLETCONNECT_PROJECT_ID = process.env['NX_WALLETCONNECT_PROJECT_ID']; export const SITE_URL = 'https://haqq.network'; - -console.log({ - VERCEL_URL: process.env['VERCEL_URL'], - NEXT_PUBLIC_VERCEL_URL: process.env['NEXT_PUBLIC_VERCEL_URL'], -}); diff --git a/apps/islamic-website/app/[locale]/layout.tsx b/apps/islamic-website/app/[locale]/layout.tsx index df14846e2..d31f7ad80 100644 --- a/apps/islamic-website/app/[locale]/layout.tsx +++ b/apps/islamic-website/app/[locale]/layout.tsx @@ -90,7 +90,7 @@ export default async function LocaleLayout({ vcrFont.variable, )} > - + {isScamBannerShow && } diff --git a/apps/islamic-website/constants.ts b/apps/islamic-website/constants.ts index eb9e827c4..b23bc7178 100644 --- a/apps/islamic-website/constants.ts +++ b/apps/islamic-website/constants.ts @@ -3,13 +3,6 @@ export const DEPLOY_URL = process.env['VERCEL_URL'] : process.env['NEXT_PUBLIC_VERCEL_URL'] ? `https://${process.env['NEXT_PUBLIC_VERCEL_URL']}` : 'http://localhost:4200'; - -// export const DEPLOY_URL = process.env['VERCEL_URL'] -// ? process.env['VERCEL_URL'] !== '' -// ? process.env['VERCEL_URL'] -// : process.env['NEXT_PUBLIC_VERCEL_URL'] ?? 'http://localhost:3000' -// : process.env['NEXT_PUBLIC_VERCEL_URL'] ?? 'http://localhost:3000'; - export const VERCEL_ENV = process.env['VERCEL_ENV']; export const REVALIDATE_TIME = 300; export const FALCONER_ENDPOINT = process.env['FALCONER_ENDPOINT']; @@ -17,8 +10,3 @@ export const TURNSTILE_SITEKEY = process.env['TURNSTILE_SITEKEY']; export const SUPPORTED_LOCALES: Readonly = ['en', 'ar', 'id']; export const SITE_URL = 'https://islamiccoin.net'; export const BLOCKED_COUNTRY = 'AE'; - -export const NEXT_PUBLIC_VERCEL_URL = process.env['NEXT_PUBLIC_VERCEL_URL']; -export const VERCEL_URL = process.env['VERCEL_URL']; - -console.log({ NEXT_PUBLIC_VERCEL_URL, VERCEL_URL }); diff --git a/apps/islamic-website/next.config.js b/apps/islamic-website/next.config.js index 4abd0e927..f590be168 100644 --- a/apps/islamic-website/next.config.js +++ b/apps/islamic-website/next.config.js @@ -37,14 +37,10 @@ const nextConfig = { }, ], }, - env: { - VERCEL_URL: process.env['VERCEL_URL'], - NEXT_PUBLIC_VERCEL_URL: process.env['NEXT_PUBLIC_VERCEL_URL'], - }, rewrites: async () => { return [ { - source: '/ingest/:path*', + source: '/api/ingest/:path*', destination: 'https://eu.posthog.com/:path*', }, ]; diff --git a/apps/islamic-website/providers/posthog.tsx b/apps/islamic-website/providers/posthog.tsx index fc3e6a49e..ec2106ecf 100644 --- a/apps/islamic-website/providers/posthog.tsx +++ b/apps/islamic-website/providers/posthog.tsx @@ -1,21 +1,21 @@ 'use client'; +import { PropsWithChildren } from 'react'; import posthog from 'posthog-js'; import { PostHogProvider } from 'posthog-js/react'; -import { DEPLOY_URL, NEXT_PUBLIC_VERCEL_URL, VERCEL_URL } from '../constants'; -if (typeof window !== 'undefined') { - console.log('posthog-init', { - DEPLOY_URL, - NEXT_PUBLIC_VERCEL_URL, - VERCEL_URL, - }); - posthog.init(process.env['NEXT_PUBLIC_POSTHOG_KEY']!, { - api_host: new URL('/ingest', DEPLOY_URL).toString(), - ui_host: process.env['NEXT_PUBLIC_POSTHOG_HOST'], - capture_pageview: false, - }); -} +export function PHProvider({ + children, + hostname, +}: PropsWithChildren<{ hostname: string }>) { + if (typeof window !== 'undefined') { + console.log('posthog-init', { hostname }); + + posthog.init(process.env['NEXT_PUBLIC_POSTHOG_KEY']!, { + api_host: new URL('/api/ingest', hostname).toString(), + ui_host: process.env['NEXT_PUBLIC_POSTHOG_HOST'], + capture_pageview: false, + }); + } -export function PHProvider({ children }: { children: React.ReactNode }) { return {children}; }