{"version":3,"file":"GeoProvider.LUqTKJB_.mjs","names":["useStore","useState"],"sources":["https:/framerusercontent.com/modules/vj7bFUjvEQFgEzNBkdoG/vf3CKm378wlVcBk7IhSU/createStore.js","https:/framer.com/m/framer/store.js@^1.0.0","https:/framerusercontent.com/modules/TSBJ5uK7ZiAeSCK6Q2jH/PQn2luVlTLfJTAb1MtOy/Functions.js","https:/framerusercontent.com/modules/jw0lqrjbEQ5lLPN76oOo/1Hbe7GYeP8qqZHWXAIL6/GeoProvider.js"],"sourcesContent":["import{useState,useEffect}from\"react\";import{Data,useObserveData}from\"framer\";export function createStore(state1){// Use Data so that a Preview reload resets the state\nconst dataStore=Data({state:Object.freeze({...state1})});// Create a set function that updates the state\nconst setDataStore=newState=>{// If the state is an object, make sure we copy it\nif(typeof newState===\"function\"){newState=newState(dataStore.state);}dataStore.state=Object.freeze({...dataStore.state,...newState});};// Store the initial state, copy the object if it's an object\nlet storeState=typeof state1===\"object\"?Object.freeze({...state1}):state1;// Keep a list of all the listeners, in the form of React hook setters\nconst storeSetters=new Set();// Create a set function that updates all the listeners / setters\nconst setStoreState=newState=>{// If the state is an object, make sure we copy it\nif(typeof newState===\"function\"){newState=newState(storeState);}storeState=typeof newState===\"object\"?Object.freeze({...storeState,...newState}):newState;// Update all the listeners / setters with the new value\nstoreSetters.forEach(setter=>setter(storeState));};// Create the actual hook based on everything above\nfunction useStore(){// Create the hook we are going to use as a listener\nconst[state,setState]=useState(storeState);// If we unmount the component using this hook, we need to remove the listener\n// @ts-ignore\nuseEffect(()=>{// But right now, we need to add the listener\nstoreSetters.add(setState);return()=>storeSetters.delete(setState);},[]);// If Data context exists, use Data, otherwise use vanilla React state\nif(useObserveData()===true){useObserveData();return[dataStore.state,setDataStore];}else{// Return the state and a function to update the central store\nreturn[state,setStoreState];}}return useStore;}\nexport const __FramerMetadata__ = {\"exports\":{\"createStore\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./createStore.map","/*\n * createStore (framer/store@1.0.1)\n *\n * Learn More: https://www.framer.com/asset-urls\n */\n\nexport * from \"https://framerusercontent.com/modules/vj7bFUjvEQFgEzNBkdoG/vf3CKm378wlVcBk7IhSU/createStore.js\"\n","const getParameterValue=key=>{const urlParams=new URLSearchParams(window.location.search);return urlParams.get(key);};export const getCurrentCountryCode=async()=>{const endpoint=\"https://api.country.is/\";try{const override=getParameterValue(\"test_locale\");if(override){console.log(\"Locale override : \"+override);return override.toUpperCase();}const response=await fetch(endpoint);const{country}=await response.json();return country;}catch(error){console.error(error);return\"IE\";}};// export const getCurrentCountryCode = async () => {\n//     const endpoint = \"http://ip-api.com/json/\"\n//     try {\n//         const override = getParameterValue(\"test_locale\")\n//         if (override) {\n//             console.log(\"Locale override: \" + override)\n//             return override.toUpperCase()\n//         }\n//         const response = await fetch(endpoint)\n//         const data = await response.json()\n//         if (data.status !== \"success\") {\n//             throw new Error(\"IP API request failed\")\n//         }\n//         return data.countryCode.toUpperCase()\n//     } catch (error) {\n//         console.error(error)\n//         return \"IE\"\n//     }\n// }\nexport const fetchAPIData=async()=>{const endpoint=\"https://www.uxdesigninstitute.com/api/courses\";try{const response=await fetch(endpoint);const data=await response.json();return data;}catch(error){console.error(error);return null;}};export const getCourseSlug=()=>{const path=window?.location?.pathname;return path;};\nexport const __FramerMetadata__ = {\"exports\":{\"fetchAPIData\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getCurrentCountryCode\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getCourseSlug\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Functions.map","import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useEffect}from\"react\";import{createStore}from\"https://framer.com/m/framer/store.js@^1.0.0\";import{getCurrentCountryCode}from\"https://framerusercontent.com/modules/TSBJ5uK7ZiAeSCK6Q2jH/PQn2luVlTLfJTAb1MtOy/Functions.js\";const useStore=createStore({countryCode:\"ie\",loading:true});const supportedCountriesPerCourse={PDUX:[\"ie\",\"de\",\"nl\",\"se\",\"pl\",\"gb\",\"us\",\"ca\",\"au\",\"nz\",\"za\"],PCCD:[\"ie\",\"de\",\"nl\",\"se\",\"pl\",\"gb\",\"us\",\"ca\",\"au\",\"nz\",\"za\"],PCUR:[\"ie\",\"de\",\"nl\",\"se\",\"pl\",\"gb\",\"us\",\"ca\",\"au\",\"nz\",\"za\"],PCDA:[\"ie\",\"gb\",\"us\",\"ca\",\"au\",\"nz\",\"za\"],UXF:[\"ie\",\"de\",\"nl\",\"se\",\"pl\",\"gb\",\"us\",\"ca\",\"au\",\"nz\",\"za\"],WWD:[\"ie\",\"de\",\"nl\",\"se\",\"pl\",\"gb\",\"us\",\"ca\",\"au\",\"nz\",\"za\"],AIF:[\"ie\",\"gb\",\"us\"],AIUR:[\"ie\",\"gb\",\"us\"],AIP:[\"ie\",\"gb\",\"us\"]};const countrySubstitutionMap={nz:\"au\"};export function withCountryCode(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const[store,setStore]=useStore();useEffect(()=>{const fetchCountryCode=async()=>{try{const code=await getCurrentCountryCode();let countryCode=code.toLowerCase();// Apply country substitution\ncountryCode=countrySubstitutionMap[countryCode]||countryCode;// Get supported countries\nconst courseCountries=supportedCountriesPerCourse[props.courseCode]||[];const finalCode=courseCountries.includes(countryCode)?countryCode:\"ie\";setStore({countryCode:finalCode,loading:false});}catch(error){console.error(\"Failed to set country code:\",error);setStore({countryCode:\"ie\",loading:false});}};fetchCountryCode();},[]);return /*#__PURE__*/_jsx(Component,{ref:ref,...props,countryCode:store.countryCode,loading:store.loading});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withCountryCode\":{\"type\":\"reactHoc\",\"name\":\"withCountryCode\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":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