{"version":3,"file":"Live_pricing_cache.idN784wJ.mjs","names":[],"sources":["https:/framerusercontent.com/modules/rf7AA1DfRPDSrhfmrmpj/dKau7FhYy42WCs2fsPCY/Live_pricing_config.js","https:/framerusercontent.com/modules/CyNT4Zo4FfF9Gv96WuEJ/on07B49iJPW4gAkICFRL/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){return true;}// Cache expired - need to fetch\nif(!isCacheValid(cache)){return true;}// Market changed - need to fetch\nif(currentMarket&&cache.market!==currentMarket){return true;}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\":{\"LivePricingCacheData\":{\"type\":\"tsType\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"clearLivePricingCache\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getLivePricingFromCache\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"isCacheValid\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"saveLivePricingToCache\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"shouldFetchLivePricing\":{\"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,EAAI,KCE9H,SAAgB,GAAyB,CAAC,GAAG,CAAC,IAAM,EAAO,aAAa,QAAQ,CAAS,EAAyD,OAAnD,EAAgC,KAAK,MAAM,CAAoB,EAAjD,IAAmD,OAAO,EAAM,CAA0D,OAAzD,QAAQ,MAAM,oCAAoC,CAAK,EAAS,IAAK,CAAC,CAEpP,SAAgB,EAAuB,EAAK,EAAO,CAAC,GAAG,CAAC,IAAM,EAAU,CAAC,OAAK,UAAU,KAAK,IAAI,EAAE,SAAO,gBAAgB,EAAoB,gBAAgB,EAAE,aAAa,QAAQ,EAAU,KAAK,UAAU,CAAS,CAAC,CAAE,OAAO,EAAM,CAAC,QAAQ,MAAM,mCAAmC,CAAK,CAAE,CAAC,CAEjS,SAAgB,EAAa,EAAM,EAAW,EAAoB,kBAAkB,CAA6E,OAAxE,GAAqC,KAAK,IAAI,EAAE,EAAM,WAAW,IAAI,GAAqB,EAA7E,EAAwF,CAM9L,SAAgB,EAAuB,EAAc,CAAC,IAAM,EAAM,EAAwB,EAGhC,MAA7D,GAFG,CAAC,GACD,CAAC,EAAa,CAAK,GACnB,GAAe,EAAM,SAAS,EAAyC,CAEvE,SAAgB,GAAuB,CAAC,GAAG,CAAC,aAAa,WAAW,CAAS,CAAE,OAAO,EAAM,CAAC,QAAQ,MAAM,qCAAqC,CAAK,CAAE,CAAC,mBAjBpB,EAAO,EAAU"}