import { useEffect } from 'react'; /** * Hook to set the document title dynamically * @param title - The page title to set * @param suffix - Optional suffix (default: store name from settings) */ export function usePageTitle(title: string, suffix?: string) { useEffect(() => { const storeName = (window as any).woonoowCustomer?.storeName || 'Store'; const finalSuffix = suffix ?? storeName; document.title = title ? `${title} | ${finalSuffix}` : finalSuffix; // Cleanup: restore original title when component unmounts return () => { // Don't restore - let the next page set its own title }; }, [title, suffix]); } export default usePageTitle;