{"version":3,"file":"formatMoney.BQPg2oCT.mjs","names":[],"sources":["https:/framerusercontent.com/modules/7YsGDU9oR06chWIhsZlS/Epl6SWFUjul3YlgWOEqD/catalogStore.js","https:/framerusercontent.com/modules/XZkEoAxCgJcoDO8UmVHY/2xJUnCzyYkJt7jdmiNGQ/catalog.js","https:/framerusercontent.com/modules/mExCm5r1EgH2vT7VdxEb/Ss2ejiiGcOUyVUYSUMYU/formatMoney.js"],"sourcesContent":["/**\n * FILE: catalogStore.tsx\n * LOCATION: framer/stores/catalogStore.tsx\n * LAYER: Store (Domain State – Catalog)\n *\n * RESPONSIBILITY:\n * - Hold enriched catalog items fetched from /catalog/information\n * - Track fetch status and error state\n * - Provide reactive catalog state to UI\n *\n * DOES NOT:\n * - Call catalog API directly (api/catalog.tsx owns fetching)\n * - Persist catalog state\n * - Hold PDP UI state (selectedVariantId lives in productStore)\n *\n * AUTHORITY:\n * - Canonical catalog data defined by importa-catalog lambda\n *\n * DATA FLOW:\n * api/catalog.tsx → catalogStore → ProductList, AromaList, PDP overrides\n */import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";export const useCatalogStore=createStore({status:\"idle\",items:[],error:null});\nexport const __FramerMetadata__ = {\"exports\":{\"CatalogStatus\":{\"type\":\"tsType\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"CatalogState\":{\"type\":\"tsType\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useCatalogStore\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./catalogStore.map","import{RenderTarget}from\"framer\";import{apiFetch,fetchWithRetry}from\"https://framerusercontent.com/modules/pBL9xlYciLON0IYG5ZYl/Fipr2hsePg07IbR1SI79/apiClient.js\";const CACHE_KEY=\"importa_catalog\";const CACHE_TTL=10*60*1e3// 10 minutes\n;let _fetching=false;let _loaded=false;/* -------------------------------------------------------\n   hydrateFromSessionStorage\n------------------------------------------------------- */export function hydrateFromSessionStorage(setState){try{const raw=sessionStorage.getItem(CACHE_KEY);if(!raw)return;const parsed=JSON.parse(raw);if(Array.isArray(parsed?.items)&&typeof parsed?.timestamp===\"number\"&&Date.now()-parsed.timestamp<CACHE_TTL){setState({status:\"loaded\",items:parsed.items,error:null});_loaded=true;}}catch{}}/* -------------------------------------------------------\n   loadCatalog\n------------------------------------------------------- */export async function loadCatalog(setState){if(RenderTarget.current()===RenderTarget.canvas)return;if(_fetching||_loaded)return;_fetching=true;setState({status:\"loading\",error:null});try{const{ok,data}=await fetchWithRetry(()=>apiFetch(\"/catalog/information\"),{attempts:3,baseDelayMs:1e3});if(!ok||!Array.isArray(data?.items)){throw new Error(data?.error||\"Failed to load catalog\");}const items=data.items;setState({status:\"loaded\",items,error:null});_loaded=true;try{sessionStorage.setItem(CACHE_KEY,JSON.stringify({items,timestamp:Date.now()}));}catch{}}catch(err){setState({status:\"error\",error:err?.message??\"Unknown error\"});}finally{_fetching=false;}}/* -------------------------------------------------------\n   getProductByHandle\n------------------------------------------------------- */export function getProductByHandle(items,handle){if(!handle||!Array.isArray(items))return null;return items.find(p=>p.handle===handle)??null;}\nexport const __FramerMetadata__ = {\"exports\":{\"loadCatalog\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"hydrateFromSessionStorage\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getProductByHandle\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}","/**\n * FILE: formatMoney.ts\n * LOCATION: framer/api/formatMoney.ts\n * LAYER: Utility (Formatting)\n *\n * RESPONSIBILITY:\n * - Format monetary values for display\n * - Normalize currency presentation\n *\n * DOES NOT:\n * - Fetch pricing data\n * - Perform currency conversion logic\n * - Store state\n *\n * AUTHORITY:\n * - Pure formatting utility (no backend dependency)\n */export function formatMoney(amount,currency=\"CAD\"){if(amount==null||amount===\"\")return\"\";const value=typeof amount===\"string\"?parseFloat(amount):amount;if(isNaN(value))return\"\";return new Intl.NumberFormat(\"en-CA\",{style:\"currency\",currency}).format(value);}\nexport const __FramerMetadata__ = {\"exports\":{\"formatMoney\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./formatMoney.map"],"mappings":"kMAoBwE,CAAa,EAAgB,EAAY,CAAC,OAAO,OAAO,MAAM,EAAE,CAAC,MAAM,KAAK,CAAC,ICjB3F,SAAgB,EAA0B,EAAS,CAAC,GAAG,CAAC,IAAM,EAAI,eAAe,QAAQ,EAAU,CAAC,GAAG,CAAC,EAAI,OAAO,IAAM,EAAO,KAAK,MAAM,EAAI,CAAI,MAAM,QAAQ,GAAQ,MAAM,EAAE,OAAO,GAAQ,WAAY,UAAU,KAAK,KAAK,CAAC,EAAO,UAAU,IAAW,EAAS,CAAC,OAAO,SAAS,MAAM,EAAO,MAAM,MAAM,KAAK,CAAC,CAAC,EAAQ,SAAY,GAE3U,eAAsB,EAAY,EAAS,CAAI,KAAa,SAAS,GAAG,EAAa,QAAiB,KAAW,GAA8B,CAAf,EAAU,GAAK,EAAS,CAAC,OAAO,UAAU,MAAM,KAAK,CAAC,CAAC,GAAG,CAAC,GAAK,CAAC,KAAG,QAAM,MAAM,MAAmB,EAAS,uBAAuB,CAAC,CAAC,SAAS,EAAE,YAAY,IAAI,CAAC,CAAC,GAAG,CAAC,GAAI,CAAC,MAAM,QAAQ,GAAM,MAAM,CAAE,MAAU,MAAM,GAAM,OAAO,yBAAyB,CAAE,IAAM,EAAM,EAAK,MAAM,EAAS,CAAC,OAAO,SAAS,QAAM,MAAM,KAAK,CAAC,CAAC,EAAQ,GAAK,GAAG,CAAC,eAAe,QAAQ,EAAU,KAAK,UAAU,CAAC,QAAM,UAAU,KAAK,KAAK,CAAC,CAAC,CAAC,MAAO,SAAS,EAAI,CAAC,EAAS,CAAC,OAAO,QAAQ,MAAM,G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