"use client"; import { useSearchParams } from 'next/navigation'; import { useEffect } from 'react'; import Header from "@/components/shared/layout/header/Header"; import Footer from "@/components/shared/layout/footer/Footer"; import { Suspense } from 'react'; import { usePolicy } from '@/lib/hooks/usePolicy'; import { generateMetadata as createMetadata } from "@/lib/seo/metadata"; const PolicyContent = () => { const searchParams = useSearchParams(); const typeParam = searchParams.get('type') || 'privacy'; const type = typeParam as 'privacy' | 'terms' | 'support'; const { data: policy, isLoading, error } = usePolicy(type); // Update metadata based on policy type useEffect(() => { const policyTitles = { privacy: 'Privacy Policy - Data Protection & Privacy', terms: 'Terms of Use - Terms & Conditions', support: 'Support Policy - Support Terms & Guidelines', }; const policyDescriptions = { privacy: 'Read GNX Soft\'s Privacy Policy to understand how we collect, use, and protect your personal information and data.', terms: 'Review GNX Soft\'s Terms of Use and Conditions for using our software services and platforms.', support: 'Learn about GNX Soft\'s Support Policy, including support terms, response times, and service level agreements.', }; const metadata = createMetadata({ title: policyTitles[type], description: policyDescriptions[type], keywords: [ type === 'privacy' ? 'Privacy Policy' : type === 'terms' ? 'Terms of Use' : 'Support Policy', 'Legal Documents', 'Company Policies', 'Data Protection', 'Terms and Conditions', ], url: `/policy?type=${type}`, }); document.title = metadata.title || `${policyTitles[type]} | GNX Soft`; let metaDescription = document.querySelector('meta[name="description"]'); if (!metaDescription) { metaDescription = document.createElement('meta'); metaDescription.setAttribute('name', 'description'); document.head.appendChild(metaDescription); } metaDescription.setAttribute('content', metadata.description || policyDescriptions[type]); }, [type]); if (isLoading) { return (

Loading policy...

); } if (error || !policy) { return (

Unable to Load Policy

{error?.message || 'The requested policy could not be found.'}

Return to Support Center
); } return (
{/* Policy Header */}

{policy.title}

Last Updated: {new Date(policy.last_updated).toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric' })}

Version {policy.version}

Effective Date: {new Date(policy.effective_date).toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric' })}

{policy.description && (

{policy.description}

)}
{/* Policy Content */}
{policy.sections.map((section) => (

{section.heading}


(a)') .replace(/\(b\)/g, '

(b)') .replace(/\(c\)/g, '

(c)') .replace(/\(d\)/g, '

(d)') .replace(/\(e\)/g, '

(e)') .replace(/\(f\)/g, '

(f)') .replace(/\(g\)/g, '

(g)') .replace(/\(h\)/g, '

(h)') .replace(/\(i\)/g, '

(i)') .replace(/\(j\)/g, '

(j)') .replace(/\(k\)/g, '

(k)') .replace(/\(l\)/g, '

(l)') // Handle pipe separators for contact information .replace(/ \| /g, '
') .replace(/: /g, ': ') // Handle semicolon with parenthesis .replace(/; \(/g, ';

(') // Add spacing after periods in long sentences .replace(/\. ([A-Z])/g, '.

$1') }} />
))}
{/* Contact Section */}

Questions?

If you have any questions about this policy, please don't hesitate to contact us.

Contact Us
); }; const PolicyPage = () => { return (
Loading...
}>