{"version":3,"sources":["../ts/education/gdpr_consent.ts"],"names":["jquery_1","default","cookieName","cookieExpire","$consentBox","gdprCookies","js_cookie_1","withConverter","read","value","name","decodeURI","toString","write","encodeURI","setCookie","cookieData","i","mo2Val","push","expires","Date","cookieValue","setDate","getDate","join","set","domain","hostName","window","location","hostname","substring","lastIndexOf","path","refreshCookie","values","get","optOut","optOutData","split","length","e","loadGA4Scripts","scripts","document","getElementsByTagName","scriptGA","createElement","scriptGtag","type","async","src","parentNode","insertBefore","toggle","on","preventDefault","ts","getTime","consent","c1","c2","c3","c4","c5","c6","c7","c8","c9","c10","c11","c12","c13","c14","c15","hide","indexOf"],"mappings":"oQAGAA,SAAAC,QAAG,KACF,MAAMC,WAAa,aACnBC,aAAe,GACfC,YAAcJ,SAAAC,QAAG,gBAAgB,EACjC,IAAII,YAAcC,YAAAL,QAAQM,cAAc,CACvCC,KAAM,SAAUC,MAAOC,MACtB,OAAOC,UAAUF,MAAMG,SAAQ,CAAE,CAClC,EACAC,MAAO,SAAUJ,MAAOC,MACvB,OAAOI,UAAUL,MAAMG,SAAQ,CAAE,CAClC,C,CACA,EAWD,SAASG,UAAUC,YAClB,IACQC,EADJC,OAAkB,GACtB,IAAQD,KAAKD,WACZE,OAAOC,KAAKF,EAAI,IAAMD,WAAWC,EAAE,EAEpC,IAAIG,QAAQ,IAAIC,KAEZC,aADJF,QAAQG,QAAQH,QAAQI,QAAO,EAAKrB,YAAY,EAC7Be,OAAOO,KAAK,GAAI,GACnCpB,YAAYqB,IAAKxB,WAAYoB,YAAa,CACzCK,QAbqBC,YAaCC,OAAOC,SAASC,UAZvBC,UAAUJ,YAASK,YAAY,IAAKL,YAASK,YAAY,GAAG,EAAI,CAAC,CAAC,EAajFb,QAAAA,QACAc,KAAM,G,CACN,CACF,CAEA,SAASC,gBACRpB,UAID,WACC,IAAIqB,OAAO,GACX,IACC,IAAIpB,WAAcX,YAAYgC,IAAInC,UAAU,EAC5C,GAAGc,WAAW,CACb,IAAIC,EA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eAAc,CAqCjB,CAAC,EAEDvC,YAAYoD,GAAI,QAAS,sBAAuBd,KAI/C,EAEDtC,YAAYoD,GAAI,QAAS,uBAAwBd,KAIhD,EACF,CAAC","file":"gdpr_consent.js","sourcesContent":["import cookies from 'js-cookie';\r\nimport $ from 'jquery';\r\n\r\n$( () => {\r\n\tconst cookieName = 'CONSENTMGR',\r\n\tcookieExpire = 60,\r\n\t$consentBox = $( '#tiGDPRecModal' );\r\n\tvar gdprCookies = cookies.withConverter({\r\n\t\tread: function (value, name) {\r\n\t\t\treturn decodeURI(value.toString());\r\n\t\t},\r\n\t\twrite: function (value, name) {\r\n\t\t\treturn encodeURI(value.toString());\r\n\t\t}\r\n\t});\r\n\r\n\tfunction setPreferencesValues() {\r\n\t\tvar cookieData={ts:new Date().getTime(),consent:true,c1:1,c2:1,c3:1,c4:1,c5:1,c6:1,c7:1,c8:1,c9:1,c10:1,c11:1,c12:1,c13:1,c14:1,c15:1};\r\n\t\tsetCookie(cookieData);\r\n\t}\r\n\r\n\tfunction getDomainName(hostName) {\r\n\t\treturn hostName.substring(hostName.lastIndexOf(\".\", hostName.lastIndexOf(\".\") - 1));\r\n\t}\r\n\r\n\tfunction setCookie(cookieData) {\r\n\t\tvar mo2Val: string[]= [];\r\n\t\tfor(var i in cookieData) {\r\n\t\t\tmo2Val.push(i + \":\" + cookieData[i]);\r\n\t\t}\r\n\t\tvar expires=new Date();\r\n\t\texpires.setDate(expires.getDate() + cookieExpire);\r\n\t\tvar cookieValue = (mo2Val.join(\"|\"));\r\n\t\tgdprCookies.set( cookieName, cookieValue, {\r\n\t\t\tdomain: getDomainName(window.location.hostname),\r\n\t\t\texpires,\r\n\t\t\tpath: '/'\r\n\t\t} );\r\n\t}\r\n\t\r\n\tfunction refreshCookie() {\r\n\t\tsetCookie(getGDPRCookieValues());\r\n\t\tloadGA4Scripts();\r\n\t}\r\n\t\r\n\tfunction getGDPRCookieValues() {\r\n\t\tvar values={}; \r\n\t\ttry{\r\n\t\t\tvar cookieData = gdprCookies.get(cookieName);\r\n\t\t\tif(cookieData){\r\n\t\t\t\tvar i,optOut,optOutData=(cookieData).split(\"|\");\r\n\t\t\t\tfor(i=0;i= 0) {\r\n\t\t\t\tloadGA4Scripts();\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\tfunction loadGA4Scripts(){\r\n\t\tvar scripts = document.getElementsByTagName(\"script\")[0];\r\n\t\t\t\t// var script = document.createElement(\"script\");\t\t\t\t\r\n\t\t\t\t// script.type = \"text/javascript\",\r\n\t\t\t\t// script.async = !0,\r\n\t\t\t\t//script.src = \"/App_Themes/v2/js/education/googletagmanager.js\",\r\n\t\t\t\t//scripts.parentNode.insertBefore(script, scripts);\r\n\t\t\t\tvar scriptGA = document.createElement(\"script\");\t\t\t\t\r\n\t\t\t\tscriptGA.type = \"text/javascript\",\r\n\t\t\t\tscriptGA.async = !0,\r\n\t\t\t\tscriptGA.src = \"/App_Themes/v2/js/education/GA4/analytics.js\",\r\n\t\t\t\tscripts.parentNode.insertBefore(scriptGA, scripts);\r\n\t\t\t\tvar scriptGtag = document.createElement(\"script\");\t\t\t\t\r\n\t\t\t\tscriptGtag.type = \"text/javascript\",\r\n\t\t\t\tscriptGtag.async = !0,\r\n\t\t\t\tscriptGtag.src = \"/App_Themes/Default/js/modules/ga4-gtm.js\",\r\n\t\t\t\tscripts.parentNode.insertBefore(scriptGtag, scripts);\r\n\t}\r\n\r\n\tif(cookies.get( cookieName )) {\r\n\t\trefreshCookie();\r\n\t}\r\n\r\n\tif( !$consentBox.length ) return;\r\n\t$consentBox.toggle( !cookies.get( cookieName ) );\r\n\t\r\n\r\n\t$consentBox.on( 'click', '#consent_prompt_submit', e => {\r\n\t\te.preventDefault();\r\n\t\tsetPreferencesValues();\t\t\r\n\t\t$consentBox.hide();\r\n\t\tloadGACode();\r\n\t\t//location.reload();\r\n\t} );\r\n\r\n\t$consentBox.on( 'click', '#privacy_link_optin', e => {\r\n\t\t//e.preventDefault();\r\n\t\t//setPreferencesValues();\r\n\t\t//$cookieBox.hide();\r\n\t} );\r\n\r\n\t$consentBox.on( 'click', '#consent_pref_center', e => {\r\n\t\t//e.preventDefault();\r\n\t\t//setPreferencesValues();\r\n\t\t//$consentBox.hide();\r\n\t} );\r\n} );\r\n"]}