/** * @component StoreFooter * @purpose Footer with dynamic CMS data — columns, contact info, social links, and payment icons * loaded from /api/v1/storefront/footer-info. Gracefully falls back to static defaults. * @dependencies storefrontService, lucide-react */ 'use client'; import { useState, useEffect } from 'react'; import Link from 'next/link'; import { Phone, Globe, Share2, Link2, ExternalLink } from 'lucide-react'; import { storefrontService, FooterInfo } from '@/services/api/storefrontService'; const SOCIAL_ICONS: Record = { facebook: , instagram: , twitter: , globe: , }; const FALLBACK_FOOTER: FooterInfo = { phone: '+91 99999 99999', email: 'support@ifixkart.com', address: 'iFixKart Service Center, MG Road, Bengaluru, Karnataka - 560001', copyright: '© 2026 iFixKart. All rights reserved.', social_links: [ { platform: 'Facebook', url: '#', icon: 'facebook' }, { platform: 'Instagram', url: '#', icon: 'instagram' }, { platform: 'Twitter', url: '#', icon: 'twitter' }, ], columns: [ { title: 'Get to Know Us', links: [{ label: 'About Us', href: '/about' }, { label: 'Term & Policy', href: '/terms' }, { label: 'Careers', href: '/careers' }, { label: 'Contact Us', href: '/contact' }] }, { title: 'Information', links: [{ label: 'Help Center', href: '/help' }, { label: 'FAQs', href: '/faqs' }, { label: 'Payments', href: '/payments' }] }, { title: 'Orders & Returns',links: [{ label: 'Track Order', href: '/account' }, { label: 'Services', href: '/services' }, { label: 'Returns', href: '/returns' }] }, { title: 'Our Store', links: [{ label: 'Best Seller', href: '/products?sort=best-sellers' }, { label: 'New Products', href: '/products?sort=newest' }, { label: 'On Sale', href: '/products?on_sale=true' }] }, ], payment_methods: [ { name: 'Visa' }, { name: 'Mastercard' }, { name: 'UPI' }, { name: 'Razorpay' }, ], }; export function StoreFooter() { const [footer, setFooter] = useState(null); useEffect(() => { storefrontService.getFooterInfo().then(setFooter).catch(() => setFooter(FALLBACK_FOOTER)); }, []); const info = footer || FALLBACK_FOOTER; // Support both new (columns[]) and legacy (get_to_know_us / information / orders_returns / our_store) formats const navColumns: { title: string; links: { label: string; href: string }[] }[] = info.columns && info.columns.length > 0 ? info.columns : [ { title: 'Get to Know Us', links: info.get_to_know_us || [] }, { title: 'Information', links: info.information || [] }, { title: 'Orders & Returns', links: info.orders_returns || [] }, { title: 'Our Store', links: info.our_store || [] }, ].filter((c) => c.links.length > 0); const socials = info.social_links || []; const payments = info.payment_methods || []; return ( ); }