{"version":3,"file":"cookies.js","mappings":";+JAAaA,EAAwB,CACnCC,KAAM,0BACNC,MAAO,WACPC,SAAU,yOCOG,SAASC,EAASC,GACvB,IAAAC,EAAUD,EAAK,MACjBE,EAAWP,EACXQ,EDPD,SAAoBC,GAIzB,IAHA,IAAMR,EAAOQ,EAAa,IACpBC,EAAUC,SAASC,OAAOC,MAAM,KAE7BC,EAAI,EAAGA,EAAIJ,EAAQK,OAAQD,IAAK,CAGvC,IAFA,IAAIF,EAASF,EAAQI,GAEO,MAArBF,EAAOI,OAAO,IACnBJ,EAASA,EAAOK,UAAU,GAE5B,GAA6B,IAAzBL,EAAOM,QAAQjB,GACjB,OAAO,EAIX,OAAO,ECRWkB,CAAUZ,EAASN,MAC/B,EAAuB,WAAwBO,GAA9CY,EAAM,KAAEC,EAAU,KAOzB,OAAID,EACK,MAIP,kBAAKE,UAAU,kBAAgB,WAC7B,mBAAKA,UAAU,0BAAwB,YACrC,0BAAKhB,EAAMiB,WAAU,KAAE,SAAC,KAAM,CAACC,QAAQ,6BACvC,gBAAKC,wBAAyB,CAACC,OAAQpB,EAAMqB,SAC7C,mBAAKL,UAAU,4BAA0B,YACvC,SAAC,KAAY,CACXM,MAAOtB,EAAMuB,iBACbC,OAjBU,YDQf,SAAoBrB,EAAoBsB,EAAqBC,GAClE,IAAMC,EAAO,IAAIC,KACjBD,EAAKE,QAAQF,EAAKG,UAA0B,GAAbJ,EAAkB,GAAK,GAAK,KAE3D,IAAMK,EAAU,kBAAWJ,EAAKK,eAChC3B,SAASC,OAAS,UAAGH,EAAU,YAAIsB,EAAW,YAAIM,EAAO,WCZvDE,CAAUhC,EAASN,KAAMM,EAASL,MAAOK,EAASJ,UAClDkB,GAAW,OAgBL,SAAC,KAAY,CACXO,MAAOtB,EAAMkC,mBACbC,UAAQ,EACRX,OAAQ,WAAM,OAAAY,OAAOC,SAASC,KAAOtC,EAAMuC","sources":["webpack://empori-base/./src/generic/CookieFunctions.ts","webpack://empori-base/./src/controls/Cookies.tsx"],"sourcesContent":["export const GeneralCookieSettings = {\r\n name: 'empori-cookies-accepted',\r\n value: 'accepted',\r\n liteTime: 365\r\n};\r\n\r\nexport function GetCookie (cookieName: string) {\r\n const name = cookieName + '=';\r\n const cookies = document.cookie.split(';');\r\n\r\n for (let i = 0; i < cookies.length; i++) {\r\n let cookie = cookies[i];\r\n\r\n while (cookie.charAt(0) === ' ') {\r\n cookie = cookie.substring(1);\r\n }\r\n if (cookie.indexOf(name) === 0) {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n}\r\n\r\nexport function SetCookie (cookieName: string, cookieValue: string, expiryDays: number) {\r\n const date = new Date();\r\n date.setTime(date.getTime() + (expiryDays * 24 * 60 * 60 * 1000));\r\n\r\n const expires = `expires=${date.toUTCString()}`;\r\n document.cookie = `${cookieName}=${cookieValue};${expires};path=/`;\r\n}","import * as React from 'react';\r\nimport { CookiesViewModel } from '../empracoTypes';\r\nimport { GeneralCookieSettings, GetCookie, SetCookie } from '../generic/CookieFunctions';\r\nimport { FaIcon } from '../generic/Icons';\r\nimport { ActionButton } from '../generic/UtilityElements';\r\n\r\ninterface CookiesProps {\r\n model: CookiesViewModel;\r\n}\r\n\r\nexport default function Cookies (props: CookiesProps) {\r\n const { model } = props;\r\n const settings = GeneralCookieSettings;\r\n const hasCookie = GetCookie(settings.name);\r\n const [hidden, hideWindow] = React.useState(hasCookie);\r\n\r\n const handleClick = () => {\r\n SetCookie(settings.name, settings.value, settings.liteTime);\r\n hideWindow(true);\r\n };\r\n\r\n if (hidden) {\r\n return null;\r\n }\r\n\r\n return(\r\n
\r\n
\r\n

{model.headerText}

\r\n
\r\n
\r\n \r\n window.location.href = model.readMoreButtonLink}/>\r\n
\r\n
\r\n
\r\n );\r\n}"],"names":["GeneralCookieSettings","name","value","liteTime","Cookies","props","model","settings","hasCookie","cookieName","cookies","document","cookie","split","i","length","charAt","substring","indexOf","GetCookie","hidden","hideWindow","className","headerText","clsName","dangerouslySetInnerHTML","__html","text","label","acceptButtonText","action","cookieValue","expiryDays","date","Date","setTime","getTime","expires","toUTCString","SetCookie","readMoreButtonText","inverted","window","location","href","readMoreButtonLink"],"sourceRoot":""}