'use client'; import React, { useEffect, useMemo, useState } from 'react'; import Link from 'next/link'; import { AnnouncementBar } from '@/layout/AnnouncementBar'; import { Header } from '@/layout/Header'; import { Navbar } from '@/layout/Navbar'; import { Footer } from '@/layout/Footer'; import { StickyHeaderSpacer } from '@/components/StickyHeaderSpacer'; import { FloatingButtons } from '@/components/FloatingButtons'; import { storefrontService, type FooterInfo, type StorefrontSettings, MOCK_FOOTER_INFO, } from '@/services/api/storefrontService'; import { buildPrivacyDoc, buildTermsDoc } from '@/lib/legalContent'; export type LegalTab = 'terms' | 'privacy'; function telHref(phone: string): string { return `tel:${phone.replace(/[^\d+]/g, '')}`; } export function LegalPage({ initialTab }: { initialTab: LegalTab }) { const [tab, setTab] = useState(initialTab); const [footer, setFooter] = useState(MOCK_FOOTER_INFO); const [settings, setSettings] = useState({ store_name: 'iFixKart' }); useEffect(() => { setTab(initialTab); }, [initialTab]); useEffect(() => { let cancelled = false; Promise.all([ storefrontService.getFooterInfo(), storefrontService.getSettings(), ]).then(([info, store]) => { if (cancelled) return; if (info) setFooter(info); if (store) setSettings(store); }); return () => { cancelled = true; }; }, []); const storeName = settings.store_name || 'iFixKart'; const phone = footer.phone || settings.support_phone || ''; const email = footer.email || ''; const address = footer.address || ''; const doc = useMemo( () => (tab === 'privacy' ? buildPrivacyDoc(storeName) : buildTermsDoc(storeName)), [tab, storeName] ); return (

Terms & Policy

Please read these terms and our privacy notice before using {storeName}.

setTab('terms')} className={`flex-1 text-center text-[14px] font-semibold py-3.5 px-4 transition-colors ${ tab === 'terms' ? 'text-primary border-b-2 border-primary -mb-px bg-primary/[0.04]' : 'text-gray-500 hover:text-[#1E293B] hover:bg-gray-50' }`} > Terms & Conditions setTab('privacy')} className={`flex-1 text-center text-[14px] font-semibold py-3.5 px-4 transition-colors ${ tab === 'privacy' ? 'text-primary border-b-2 border-primary -mb-px bg-primary/[0.04]' : 'text-gray-500 hover:text-[#1E293B] hover:bg-gray-50' }`} > Privacy Policy

{doc.heading}

Last updated: 10 September 2026

{doc.intro}

{doc.sections.map((section) => (

{section.title}

{section.paragraphs.map((p, i) => (

{p}

))}
))}

Grievance officer

In accordance with the Information Technology Act, 2000 and applicable consumer protection rules, you may write to {storeName} for complaints about these terms or our privacy practices.

{address ?

{address}

: null} {email ? (

Email:{' '} {email}

) : null} {phone ? (

Phone:{' '} {phone}

) : null}

Monday to Saturday, 10:00 AM – 6:30 PM

); }