// Global utility functions function formatCurrency(amount) { return new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(amount); } // Initialize tooltips document.addEventListener('DOMContentLoaded', function() { // Initialize any tooltips or popovers feather.replace(); // Add any global event listeners here }); // API helper functions async function getShippingRates(data) { // This would be replaced with actual API calls to backend try { const response = await fetch('/api/rates', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify(data) }); return await response.json(); } catch (error) { console.error('Error fetching rates:', error); return null; } }