{"version":3,"file":"LocalizationRedirect.csomDA_a.mjs","names":[],"sources":["https:/framerusercontent.com/modules/GsrDG9phoeAJJiSt5lSl/cwewaROOv2pjs7Q59CE2/LocalizationRedirect.js"],"sourcesContent":["// Localization redirect component - checks user's country and redirects to appropriate URL\n// If user is from the specified country, stays on base URL, otherwise redirects to alternate URL\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function LocalizationRedirect(props){const{baseUrl,alternateUrl,targetCountry,showMessage,message,backgroundColor,textColor,font}=props;useEffect(()=>{if(typeof window===\"undefined\")return;async function checkLocationAndRedirect(){try{const response=await fetch(\"https://ipapi.co/json/\");const data=await response.json();const userCountry=data.country_code;if(userCountry!==targetCountry){window.location.href=alternateUrl;}}catch(error){console.error(\"Failed to detect location:\",error);}}checkLocationAndRedirect();},[targetCountry,alternateUrl]);if(!showMessage)return null;return /*#__PURE__*/_jsx(\"div\",{style:{...props.style,position:\"relative\",width:\"100%\",height:\"100%\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",backgroundColor,color:textColor,padding:20,...font},children:/*#__PURE__*/_jsx(\"span\",{style:{textAlign:\"center\"},children:message})});}addPropertyControls(LocalizationRedirect,{targetCountry:{type:ControlType.Enum,title:\"Target Country\",defaultValue:\"SE\",options:[\"SE\",\"US\",\"GB\",\"DE\",\"FR\",\"ES\",\"IT\",\"NL\",\"BE\",\"DK\",\"NO\",\"FI\",\"CA\",\"AU\",\"NZ\",\"JP\",\"CN\",\"IN\",\"BR\",\"MX\"],optionTitles:[\"Sweden\",\"United States\",\"United Kingdom\",\"Germany\",\"France\",\"Spain\",\"Italy\",\"Netherlands\",\"Belgium\",\"Denmark\",\"Norway\",\"Finland\",\"Canada\",\"Australia\",\"New Zealand\",\"Japan\",\"China\",\"India\",\"Brazil\",\"Mexico\"],displaySegmentedControl:false},baseUrl:{type:ControlType.String,title:\"URL\",defaultValue:\"https://strativ.se\",placeholder:\"https://example.com\"},alternateUrl:{type:ControlType.String,title:\"Alternative URL\",defaultValue:\"https://strativ.se/en\",placeholder:\"https://example.com/en\"},showMessage:{type:ControlType.Boolean,title:\"Show Message\",defaultValue:false,enabledTitle:\"Show\",disabledTitle:\"Hide\"},message:{type:ControlType.String,title:\"Message\",defaultValue:\"Checking your location...\",displayTextArea:true,hidden:({showMessage})=>!showMessage},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#FFFFFF\",hidden:({showMessage})=>!showMessage},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\",hidden:({showMessage})=>!showMessage},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"15px\",variant:\"Medium\",letterSpacing:\"-0.01em\",lineHeight:\"1.3em\"},hidden:({showMessage})=>!showMessage}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"LocalizationRedirect\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./LocalizationRedirect.map"],"mappings":"wLAKG,SAAwB,EAAqB,EAAM,CAAC,GAAK,CAAC,UAAQ,eAAa,gBAAc,cAAY,UAAQ,kBAAgB,YAAU,QAAM,EAA+b,OAAzb,MAAc,CAAC,GAAU,IAAS,OAAY,OAAO,eAAe,GAA0B,CAAC,GAAG,EAAiE,MAAjD,MAAM,MAAM,yBAAyB,EAA2B,MAAM,EAAwB,eAA8B,IAAe,EAAO,SAAS,KAAK,SAAqB,EAAM,CAAC,QAAQ,MAAM,6BAA6B,EAAM,EAAG,GAA0B,EAAG,CAAC,EAAc,EAAa,CAAC,CAAK,EAA4C,EAAK,MAAM,CAA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