'use client'; import React, { useState, useEffect } from 'react'; import { ShoppingBag, CheckCircle2, ExternalLink, Copy, RefreshCw, AlertCircle, FileCode, Layers, Image as ImageIcon, Tag, ArrowUpRight, ShieldCheck } from 'lucide-react'; import { apiFetch } from '@/services/api/client'; import { API_ENDPOINTS } from '@/services/api/config'; import { toast } from 'sonner'; interface MerchantFeedStats { total_products: number; eligible_products: number; missing_images: number; missing_prices: number; generated_at: string; store_name: string; store_url: string; feed_url: string; } export default function GoogleMerchantCenterPage() { const [stats, setStats] = useState(null); const [loading, setLoading] = useState(true); const [regenerating, setRegenerating] = useState(false); const [copied, setCopied] = useState(false); const fetchStatus = async (forceRefresh: boolean = false) => { try { if (forceRefresh) setRegenerating(true); else setLoading(true); const endpoint = forceRefresh ? `${API_ENDPOINTS.GOOGLE_MERCHANT_STATUS}?force_refresh=true` : API_ENDPOINTS.GOOGLE_MERCHANT_STATUS; const res = await apiFetch<{ status: string; data: MerchantFeedStats }>(endpoint); if (res && res.data) { setStats(res.data); if (forceRefresh) { toast.success('Google Merchant RSS Feed regenerated successfully!'); } } } catch (err: unknown) { console.error('Failed to load merchant status:', err); toast.error('Failed to load Google Merchant Center status'); } finally { setLoading(false); setRegenerating(false); } }; useEffect(() => { fetchStatus(false); }, []); const copyFeedUrl = () => { if (!stats?.feed_url) return; navigator.clipboard.writeText(stats.feed_url); setCopied(true); toast.success('Feed URL copied to clipboard!'); setTimeout(() => setCopied(false), 2500); }; return (
{/* Top Header */}
Google Shopping Integration

Google Merchant Center

Automated RSS 2.0 XML product feed for Google Shopping Ads, Free Listings, and Merchant Center sync.

Inspect XML Feed
{/* Metric Cards Grid */}
Eligible Products
{loading ? '...' : (stats?.eligible_products ?? 0).toLocaleString()}

100% catalog compliance

Feed Standards
RSS 2.0

Google Base Namespace (xmlns:g)

Store Domain
{stats?.store_name || 'iFixKart'}

{stats?.store_url || 'https://ifixkart.trionixsolution.com'}

Last Generated
{stats?.generated_at ? new Date(stats.generated_at).toLocaleTimeString() : 'Real-time Cached'}

{stats?.generated_at ? new Date(stats.generated_at).toLocaleDateString() : 'Auto-refreshed'}

{/* Feed URL Copy Card */}

Merchant Center Feed URL Live Active

Paste this URL into your Google Merchant Center account under Products > Feeds > Scheduled Fetch.

{stats?.feed_url || 'https://ifixkart.trionixsolution.com/api/v1/storefront/feed/google-merchant.xml'}
{/* Feed Compliance Checklist & Schema Information */}

Google Shopping Quality Assurance

Mandatory Attributes Standard

Includes g:id, g:title, g:description, g:link, and g:image_link.

Pricing & Currency (INR)

All active items are formatted with ISO-4217 compliant 1299.00 INR price specifications.

Stock Availability Sync

Maps real-time warehouse inventory to Google tags: in_stock or out_of_stock.

Brand & Identifier Match

Transmits brand metadata (iFixKart, Apple, Samsung, OnePlus, etc.) and SKU identifiers.

{/* Integration Instructions */}

How to Setup in Google Merchant Center

  1. Log into your account at merchants.google.com .
  2. Navigate to Products → Feeds → Click Add primary feed (+).
  3. Select your target country (India) and language (English).
  4. Select Scheduled fetch and paste the feed URL copied above.
  5. Set fetch frequency to Daily at 04:00 AM IST for automatic product updates.
Google Shopping Free Listings and Performance Max Ads are fully supported.
); }