Spaces:
Running
Running
File size: 886 Bytes
36623dc | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | // 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;
}
} |