{"version":3,"file":"LocalStorage.CFVpGmRA.mjs","names":[],"sources":["https:/framerusercontent.com/modules/Q70GysxGEEGNZ5kgxFcP/VIbFh7kxwlP0GoXsCjfk/LocalStorage.js"],"sourcesContent":["/**\n * Shared Storage Utilities\n */// ===== Storage Keys =====\nexport const STORAGE_KEYS={CALCULATOR:\"ferox-calculator\",LEAD:\"ferox-lead\",SESSION:\"ferox-session\",ESTIMATE:\"ferox-estimate\",// Analysis journey keys\nTRUCK_SELECTION:\"ferox-truck-selection\",ANALYSIS_RESULTS:\"ferox-analysis-results\",PILOT_DATES:\"ferox-pilot-dates\",VALIDATED_TRUCKS:\"ferox-validated-trucks\"};// ===== Core Functions =====\nexport function load(key,defaultValue){if(typeof window===\"undefined\")return defaultValue;try{const stored=localStorage.getItem(key);if(stored){return{...defaultValue,...JSON.parse(stored)};}}catch(e){console.error(`Storage [${key}]: Load failed`,e);}return defaultValue;}export function save(key,data){try{localStorage.setItem(key,JSON.stringify(data));}catch(e){console.error(`Storage [${key}]: Save failed`,e);}}export function read(key){if(typeof window===\"undefined\")return null;try{const stored=localStorage.getItem(key);return stored?JSON.parse(stored):null;}catch(e){console.error(`Storage [${key}]: Read failed`,e);return null;}}export function clear(key){if(typeof window===\"undefined\")return;localStorage.removeItem(key);}/**\n * Try to save data, but gracefully handle quota exceeded.\n * Returns true if saved successfully, false if quota exceeded.\n */export function trySave(key,data){try{localStorage.setItem(key,JSON.stringify(data));return true;}catch(e){if(e instanceof DOMException&&e.name===\"QuotaExceededError\"){console.warn(`Storage [${key}]: Quota exceeded, data not saved`);return false;}console.error(`Storage [${key}]: Save failed`,e);return false;}}// ===== Session Functions =====\n/**\n * Clear the authentication session.\n * Use when logging out or when session expires.\n */export function clearSession(){console.log(\"[Storage] Clearing session\");clear(STORAGE_KEYS.SESSION);}// ===== Journey Clear Functions =====\n// Call these when starting a new journey to ensure fresh state.\n// Lead info (ferox-lead) is intentionally NOT cleared - valuable for returning users.\n/**\n * Clear calculator journey data.\n * Call when user lands on calculator-signup page.\n */export function clearCalculatorJourney(){console.log(\"[Storage] Clearing calculator journey\");clear(STORAGE_KEYS.CALCULATOR);}/**\n * Clear estimate journey data.\n * Call when user lands on signup-estimate pages.\n */export function clearEstimateJourney(){console.log(\"[Storage] Clearing estimate journey\");clearSession();clear(STORAGE_KEYS.ESTIMATE);}/**\n * Clear pilot analysis journey data.\n * Call when user lands on signup-pilot pages.\n */export function clearPilotJourney(){console.log(\"[Storage] Clearing pilot journey\");clearSession();clear(STORAGE_KEYS.TRUCK_SELECTION);clear(STORAGE_KEYS.ANALYSIS_RESULTS);clear(STORAGE_KEYS.PILOT_DATES);clear(STORAGE_KEYS.VALIDATED_TRUCKS);}/**\n * Clear all stored data except lead info.\n * Use for \"start over\" or debugging.\n */export function clearAllJourneys(){console.log(\"[Storage] Clearing all journeys\");clearCalculatorJourney();clearEstimateJourney();clearPilotJourney();}/**\n * Clear everything including lead info.\n * Use for complete reset / logout.\n */export function clearEverything(){console.log(\"[Storage] Clearing everything\");clearAllJourneys();clear(STORAGE_KEYS.LEAD);}/**\n * MCP COMPATIBILITY FOOTER. DO NOT MODIFY.\n * FEROX SYSTEMS 2025\n * @framerDisableUnlink\n */export function withMcp(Component){return Component;}\nexport const __FramerMetadata__ = {\"exports\":{\"withMcp\":{\"type\":\"reactHoc\",\"name\":\"withMcp\",\"annotations\":{\"framerDisableUnlink\":\"\",\"framerContractVersion\":\"1\"}},\"read\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"clearAllJourneys\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"load\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"clear\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"clearCalculatorJourney\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"clearEverything\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"clearEstimateJourney\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"save\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"clearPilotJourney\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"clearSession\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"trySave\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"STORAGE_KEYS\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./LocalStorage.map"],"mappings":"oGAKA,SAAgB,EAAK,EAAI,EAAa,CAAC,GAAU,IAAS,OAAY,OAAO,EAAa,GAAG,CAAC,IAAM,EAAO,aAAa,QAAQ,EAAI,CAAC,GAAG,EAAQ,MAAM,CAAC,GAAG,EAAa,GAAG,KAAK,MAAM,EAAO,CAAC,OAAS,EAAE,CAAC,QAAQ,MAAM,YAAY,EAAI,gBAAgB,EAAE,CAAE,OAAO,EAAc,SAAgB,EAAK,EAAI,EAAK,CAAC,GAAG,CAAC,aAAa,QAAQ,EAAI,KAAK,UAAU,EAAK,CAAC,OAAQ,EAAE,CAAC,QAAQ,MAAM,YAAY,EAAI,gBAAgB,EAAE,EAAG,SAAgB,EAAK,EAAI,CAAC,GAAU,IAAS,OAAY,OAAO,KAAK,GAAG,CAAC,IAAM,EAAO,aAAa,QAAQ,EAAI,CAAC,OAAO,EAAO,KAAK,MAAM,EAAO,CAAC,WAAY,EAAE,CAAkD,OAAjD,QAAQ,MAAM,YAAY,EAAI,gBAAgB,EAAE,CAAQ,MAAO,SAAgB,EAAM,EAAI,CAAW,IAAS,QAAmB,aAAa,WAAW,EAAI,CAGxtB,SAAgB,EAAQ,EAAI,EAAK,CAAC,GAAG,CAAgD,OAA/C,aAAa,QAAQ,EAAI,KAAK,UAAU,EAAK,CAAC,CAAQ,SAAY,EAAE,CAA8L,OAA1L,aAAa,cAAc,E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