From dbcb8bcefd6b82dbd87854957a1cd5091b27d636 Mon Sep 17 00:00:00 2001 From: smian1 Date: Wed, 4 Dec 2024 23:31:21 -0800 Subject: [PATCH] Refactor URL handling and temporarily disable Gleap initialization - Updated the canonical URL in the structured data generation to use the dynamic WEB_URL from envConfig for better maintainability. - Temporarily disabled the Gleap initialization in the GleapInit component to prevent errors when the API key is not set. These changes enhance the application's configuration management and prevent potential issues with Gleap integration. --- frontend/src/app/apps/[id]/page.tsx | 2 +- frontend/src/components/shared/gleap.tsx | 6 +++++- frontend/src/components/shared/google-analytics.tsx | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/frontend/src/app/apps/[id]/page.tsx b/frontend/src/app/apps/[id]/page.tsx index 536ee9aef..4438ae7a1 100644 --- a/frontend/src/app/apps/[id]/page.tsx +++ b/frontend/src/app/apps/[id]/page.tsx @@ -71,7 +71,7 @@ export async function generateMetadata( // Add a separate function to handle JSON-LD export function generateStructuredData(plugin: Plugin, categoryName: string) { - const canonicalUrl = `https://omi.me/apps/${plugin.id}`; + const canonicalUrl = `${envConfig.WEB_URL}/apps/${plugin.id}`; const appStoreUrl = 'https://apps.apple.com/us/app/friend-ai-wearable/id6502156163'; const playStoreUrl = 'https://play.google.com/store/apps/details?id=com.friend.ios'; const productUrl = 'https://www.omi.me/products/friend-dev-kit-2'; diff --git a/frontend/src/components/shared/gleap.tsx b/frontend/src/components/shared/gleap.tsx index 86a29b4e1..518414b09 100644 --- a/frontend/src/components/shared/gleap.tsx +++ b/frontend/src/components/shared/gleap.tsx @@ -5,7 +5,11 @@ import envConfig from '@/src/constants/envConfig'; export const GleapInit: FC<{ children?: ReactNode }> = ({ children }) => { useEffect(() => { - Gleap.initialize(envConfig.GLEAP_API_KEY ?? ''); + // Temporarily disabled Gleap initialization + // const isGleapEnabled = envConfig.GLEAP_API_KEY && process.env.NEXT_PUBLIC_ENABLE_GLEAP !== 'false'; + // if (isGleapEnabled) { + // Gleap.initialize(envConfig.GLEAP_API_KEY ?? ''); + // } }, []); return <>{children}; }; diff --git a/frontend/src/components/shared/google-analytics.tsx b/frontend/src/components/shared/google-analytics.tsx index aadee3a4f..4dde2f3ed 100644 --- a/frontend/src/components/shared/google-analytics.tsx +++ b/frontend/src/components/shared/google-analytics.tsx @@ -24,4 +24,4 @@ export function GoogleAnalytics() { ); -} \ No newline at end of file +}