{"version":3,"file":"Live_pricing_cache.C7X-WPpp.mjs","names":[],"sources":["https:/framerusercontent.com/modules/rf7AA1DfRPDSrhfmrmpj/dKau7FhYy42WCs2fsPCY/Live_pricing_config.js","https:/framerusercontent.com/modules/CyNT4Zo4FfF9Gv96WuEJ/C3ACb88i82CG2pKDbgwd/Live_pricing_cache.js"],"sourcesContent":["export const LIVE_PRICING_CONFIG={CACHE_TTL_MINUTES:10,DEFAULT_CURRENCY:\"USD\",MAX_PRODUCTS_PER_QUERY:250,ENABLE_LIVE_PRICING:true};\nexport const __FramerMetadata__ = {\"exports\":{\"LIVE_PRICING_CONFIG\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Live_pricing_config.map","import{LIVE_PRICING_CONFIG}from\"https://framerusercontent.com/modules/rf7AA1DfRPDSrhfmrmpj/dKau7FhYy42WCs2fsPCY/Live_pricing_config.js\";const CACHE_KEY=\"frameship_live_pricing_cache\";/**\n * Get live pricing data from localStorage cache\n */export function getLivePricingFromCache(){try{const cached=localStorage.getItem(CACHE_KEY);if(!cached)return null;const parsed=JSON.parse(cached);return parsed;}catch(error){console.error(\"Error reading live pricing cache:\",error);return null;}}/**\n * Save live pricing data to localStorage cache\n */export function saveLivePricingToCache(data,market){try{const cacheData={data,timestamp:Date.now(),market,defaultCurrency:LIVE_PRICING_CONFIG.DEFAULT_CURRENCY};localStorage.setItem(CACHE_KEY,JSON.stringify(cacheData));}catch(error){console.error(\"Error saving live pricing cache:\",error);}}/**\n * Check if cache is still valid (not expired)\n */export function isCacheValid(cache,ttlMinutes=LIVE_PRICING_CONFIG.CACHE_TTL_MINUTES){if(!cache)return false;const ageMinutes=(Date.now()-cache.timestamp)/1e3/60;return ageMinutes<ttlMinutes;}/**\n * Determine if live pricing should be fetched\n * Fetch if:\n * 1. No cache exists\n * 2. Cache expired (> TTL)\n * 3. Market changed (different country code)\n */export function shouldFetchLivePricing(currentMarket){const cache=getLivePricingFromCache();// No cache exists - need to fetch\nif(!cache){console.log(`[Live Pricing Cache] No cache exists, will fetch for market: ${currentMarket}`);return true;}// Cache expired - need to fetch\nif(!isCacheValid(cache)){console.log(`[Live Pricing Cache] Cache expired (${Math.round((Date.now()-cache.timestamp)/1e3/60)} min old), will fetch for market: ${currentMarket}`);return true;}// Market changed - need to fetch\nif(currentMarket&&cache.market!==currentMarket){console.log(`[Live Pricing Cache] Market changed from ${cache.market} to ${currentMarket}, will fetch`);return true;}// Cache is valid and market hasn't changed\nconsole.log(`[Live Pricing Cache] Cache valid for market ${cache.market}, skipping fetch`);return false;}/**\n * Clear live pricing cache\n */export function clearLivePricingCache(){try{localStorage.removeItem(CACHE_KEY);}catch(error){console.error(\"Error clearing live pricing cache:\",error);}}\nexport const __FramerMetadata__ = {\"exports\":{\"isCacheValid\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"clearLivePricingCache\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getLivePricingFromCache\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"shouldFetchLivePricing\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"LivePricingCacheData\":{\"type\":\"tsType\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"saveLivePricingToCache\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Live_pricing_cache.map"],"mappings":"oEAAa,EAAoB,CAAC,kBAAkB,GAAG,iBAAiB,MAAM,uBAAuB,IAAI,oBAAoB,GAAK,ICE/H,SAAgB,GAAyB,CAAC,GAAG,CAAC,IAAM,EAAO,aAAa,QAAQ,EAAU,CAAwD,OAAnD,EAAgC,KAAK,MAAM,EAAO,CAApC,WAA0D,EAAM,CAA0D,OAAzD,QAAQ,MAAM,oCAAoC,EAAM,CAAQ,MAE9O,SAA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