{"version":3,"sources":["webpack:///./Avensia.Common/Features/Shared/Blocks/CountryLink/CountryLinkBlock.tsx"],"names":["StyledLink","display","color","monochrome","a11ygrey","textDecoration","onSelectCountry","this","props","isExternalUrl","url","countryCode","redirectUrl","href","toLowerCase","json","result","window","location","render","englishName","nativeName","onClick","e","preventDefault","to","Component"],"mappings":"0JAYMA,EAAa,YAAO,IAAM,CAC9BC,QAAS,SACTC,MAAO,IAAaC,WAAWC,SAC/B,SAAU,CACRC,eAAgB,eAIpB,yE,OACE,EAAAC,gBAAkB,0D,+EACV,EAAsCC,KAAKC,MAAzCC,EAAa,gBAAEC,EAAG,MAAEC,EAAW,cACnCC,EAAcF,EACbD,EAAD,YACFG,EAAc,cAAaC,KAAO,sBAAwBF,EAAYG,c,iBAElD,O,sBAAA,GAAM,YAAIF,I,OACb,SADG,SACaG,Q,cAAzBC,EAAS,SACfC,OAAOC,SAASL,KAAOG,EAAON,I,6DAIhCO,OAAOC,SAASL,KAAOH,E,qCAkB7B,OA/B+B,iBAiB7B,YAAAS,OAAA,sBACQ,aAAEC,EAAA,EAAAA,YAAaC,EAAA,EAAAA,WAAYX,EAAA,EAAAA,IACjC,OACE,kBAACV,EAAU,CACTsB,QAAS,SAAOC,GAAC,+C,4CACfA,EAAEC,iBACFjB,KAAKD,kB,WAEPmB,GAAIf,GAEJ,8BAAOU,G,MAAsB,8BAAOC,KAI5C,EA/BA,CAA+B,IAAMK,WAiCtB","file":"assets/12.chunk.7efab4da74c37128ca35.js","sourcesContent":["/**\r\n * @ComponentFor CountryLinkBlockViewModel\r\n */\r\nimport React from 'react';\r\nimport { get, replaceState, currentUrl } from '@polarnopyret/scope';\r\nimport BlockPropType from './CountryLinkBlockViewModel.type';\r\nimport { styled } from '@glitz/react';\r\nimport Link from 'Shared/Link';\r\nimport * as style from 'Shared/Style';\r\n\r\ntype PropType = BlockPropType;\r\n\r\nconst StyledLink = styled(Link, {\r\n display: 'inline',\r\n color: style.colors.monochrome.a11ygrey,\r\n ':hover': {\r\n textDecoration: 'underline',\r\n }\r\n});\r\n\r\nclass CountryLinkBlock extends React.Component {\r\n onSelectCountry = async () => {\r\n const { isExternalUrl, url, countryCode } = this.props;\r\n let redirectUrl = url;\r\n if (!isExternalUrl) {\r\n redirectUrl = currentUrl().href + '/setmarket?country=' + countryCode.toLowerCase();;\r\n try {\r\n const valitaion = await get(redirectUrl);\r\n const result = await valitaion.json();\r\n window.location.href = result.url;\r\n } catch (error) { }\r\n }\r\n else {\r\n window.location.href = url;\r\n }\r\n };\r\n\r\n render() {\r\n const { englishName, nativeName, url } = this.props;\r\n return (\r\n {\r\n e.preventDefault();\r\n this.onSelectCountry();\r\n }}\r\n to={url}\r\n >\r\n {englishName} | {nativeName}\r\n \r\n );\r\n }\r\n}\r\n\r\nexport default CountryLinkBlock;\r\n"],"sourceRoot":""}